forked from white-ubuntu/GitHunt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.client.js
53 lines (51 loc) · 1.17 KB
/
webpack.config.client.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
const webpack = require('webpack');
const DEV = process.env.NODE_ENV !== 'production';
module.exports = {
bail: !DEV,
devtool: DEV ? 'cheap-module-source-map' : 'source-map',
entry: './ui/client.js',
output: {
path: 'build/client',
filename: 'bundle.js',
publicPath: '/',
},
module: {
loaders: [{
test: /\.css/,
loader: 'style-loader!css-loader',
}, {
test: /\.js$/,
loader: 'babel-loader',
exclude: /(node_modules)/,
}, {
test: /\.json$/,
loader: 'json-loader',
},
{
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
loader: 'graphql-tag/loader',
}]
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify(DEV ? 'development' : 'production'),
},
}),
DEV && new webpack.optimize.UglifyJsPlugin({
compress: {
screw_ie8: true, // React doesn't support IE8
warnings: false,
},
mangle: {
screw_ie8: true,
},
output: {
comments: true,
screw_ie8: true,
},
}),
DEV && new webpack.optimize.AggressiveMergingPlugin(),
].filter(Boolean),
};