-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.config.js
44 lines (42 loc) · 1.04 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
const webpack = require('webpack');
const UglifyJsPlugin = require("uglifyjs-3-webpack-plugin");
module.exports = [{
devServer: {
port: 8008,
historyApiFallback: true,
},
devtool: 'none',
entry: ["babel-polyfill", "./src/app.jsx"],
output: {
path: __dirname + '/src',
filename: "bundle.js",
publicPath: '/'
},
module: {
rules : [{
test: /\.jsx?$/,
exclude: /(node_modules)/,
loader: 'babel-loader',
query: {
presets: ['babel-preset-latest', 'react']
}
}]
},
plugins: [
new webpack.DefinePlugin({ // <-- key to reducing React's size
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new UglifyJsPlugin({
uglifyOptions: {
warnings: false,
ie8: false,
output: {
comments: false
}
}
}),
new webpack.optimize.AggressiveMergingPlugin()//Merge chunks
]
}];