forked from js-csp/js-csp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
43 lines (36 loc) · 884 Bytes
/
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
'use script';
var webpack = require('webpack');
var join = require('path').join;
var LodashPlugin = require('lodash-webpack-plugin');
var es5 = process.env.BABEL_ENV === 'es5';
var filename = 'js-csp.js';
var path = join(__dirname, 'lib');
var plugins = [new LodashPlugin];
var uglify = new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false, drop_console: true } });
if (es5) {
plugins.push(uglify);
filename = 'js-csp.es5.min.js';
path = join(__dirname, 'dist');
}
var config = {
context: __dirname,
entry: join(__dirname, 'src', 'csp'),
output: {
path: path,
filename: filename,
library: 'csp',
libraryTarget: 'umd',
umdNamedDefine: true
},
plugins: plugins,
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
}
};
module.exports = config;