-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
executable file
·58 lines (56 loc) · 1.37 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const path = require('path');
const webpack = require('webpack');
const deindent = require('deindent');
const packageJson = require('./package.json');
const { argv: args } = require('yargs');
const isProd = args.mode === 'production';
module.exports = {
context: path.join(__dirname, 'src'),
entry: {
'slidey': './slidey.module.js'
},
output: {
path: path.join(__dirname, 'dist'),
filename: isProd ? '[name].min.js' : '[name].js',
sourceMapFilename: '[file].map',
library: 'slidey',
libraryTarget: 'umd',
umdNamedDefine: true
},
externals: {
'angular': 'angular'
},
devtool: 'source-map',
module: {
rules: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}, {
test: /\.html$/,
exclude: /node_modules/,
loader: 'html-loader'
}, {
test: /\.css$/,
exclude: /node_modules/,
loader: 'raw-loader'
}]
},
optimization: {
minimize: isProd ? true : false
},
plugins: [
new webpack.BannerPlugin({
banner: deindent(`
/**
* ${packageJson.name} JavaScript Library v${packageJson.version}
*
* @license Apache 2.0 (https://github.com/BerkleyTechnologyServices/slidey/blob/master/LICENSE)
*
* Made with ♥ by ${packageJson.contributors.join(', ')}
*/
`).trim(),
raw: true
})
]
};