-
Notifications
You must be signed in to change notification settings - Fork 138
/
webpack.config.base.js
51 lines (44 loc) · 1.06 KB
/
webpack.config.base.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
var webpack = require('webpack');
module.exports = function(options) {
options = (options ? options : {});
var plugins = [];
if (options.minify) {
plugins.push(
new webpack.optimize.UglifyJsPlugin()
);
}
if (!options.dev) {
plugins.push(
new webpack.optimize.DedupePlugin(),
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("production")
}
}),
new webpack.NoErrorsPlugin(),
new webpack.optimize.OccurenceOrderPlugin()
);
}
return {
entry: {
isomer: './index.js'
},
output: {
library: 'Isomer',
libraryTarget: 'umd',
path: '/',
filename: (options.dev ? '[name].js' : (options.minify ? './dist/[name].min.js': './dist/[name].js')),
sourceMapFilename: '[file].map'
},
module: {
preLoaders: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'jscs-loader'
}]
},
plugins: plugins,
debug: (options.dev),
devtool: (options.dev ? 'eval-source-map': undefined)
};
};