-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproduction.config.js
executable file
·60 lines (59 loc) · 1.33 KB
/
production.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
52
53
54
55
56
57
58
59
60
let webpack = require('webpack');
module.exports = {
// Don't attempt to continue if there are any errors.
bail: true,
// We generate sourcemaps in production. This is slow but gives good results.
// You can exclude the *.map files from the build during deployment.
devtool: 'source-map',
entry: {
jwc: './src/index'
},
output: {
filename: 'main.js',
chunkFilename: 'main.chunk.js',
path: __dirname + '/dist'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loaders: ['babel']
}
]
},
plugins: [
// Minify the code.
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
}),
// This helps ensure the builds are consistent if source hasn't changed:
new webpack.optimize.OccurrenceOrderPlugin(),
// Try to dedupe duplicated modules, if any:
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
screw_ie8: true, // React doesn't support IE8
// warnings: false
warnings: false
},
mangle: {
screw_ie8: true
},
output: {
screw_ie8: true,
comments: false
}
})
],
resolve: {
// Using PReact to substitute for React.
// @Ref: https://preactjs.com/guide/switching-to-preact
// alias: {
// 'react': "preact-compat",
// 'react-dom': "preact-compat"
// }
}
};