-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathwebpack.config.js
More file actions
53 lines (49 loc) · 1.24 KB
/
webpack.config.js
File metadata and controls
53 lines (49 loc) · 1.24 KB
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
var webpack = require('webpack'),
merge = require('webpack-merge'),
validate = require('webpack-validator'),
rootDir = __dirname,
common, config;
common = {
entry: rootDir + '/app.jsx',
output: {
path: rootDir,
filename: 'app.js'
},
plugins: [
new webpack.ProvidePlugin({
'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
})
],
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /(node_modules)/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
}]
}
};
switch (process.env.npm_lifecycle_event) {
case 'build':
config = merge(common, {
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
]
});
break;
default:
config = merge(common, {});
break;
}
module.exports = validate(config);