-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
51 lines (48 loc) · 1.52 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
var _ = require('lodash');
var webpack = require('webpack');
var StatsPlugin = require('stats-webpack-plugin');
module.exports = function(config){
return {
development:{
name : 'browser',
// devtool : '#source-map',
devServer: true,
module : {loaders: config.devLoaders},
resolve : config.resolve,
node: {
fs: "empty" //Prevents MessageFormat from erroring
},
entry : config.devEntry,
output : config.output,
plugins : config.devPlugins.concat([
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({'process.env': {'NODE_ENV': JSON.stringify('development') } }),
])
},
production:{
name : 'browser',
devtool : '#source-map',
module : {loaders: config.loaders},
resolve : config.resolve,
node: {
fs: "empty" //Prevents MessageFormat from erroring
},
entry : config.entry,
output : config.output,
plugins : config.plugins.concat([
new webpack.DefinePlugin({'process.env': {'NODE_ENV': JSON.stringify('production') } }),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
output: {comments: false},
compress: { drop_console: true },
minimize:true,
ascii_only:true,
quote_keys:true,
sourceMap: true,
beautify: false
}),
new StatsPlugin('stats.json', { chunkModules: true, profile: true })
])
}
}
}