-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.config.js
43 lines (36 loc) · 981 Bytes
/
webpack.prod.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
var webpack = require('webpack')
var BundleTracker = require('webpack-bundle-tracker')
var config = require('./webpack.base.config.js')
config.output.path = require('path').resolve('./src/static/bundles/')
config.output.publicPath = "/static/bundles/"
config.plugins = config.plugins.concat([
new BundleTracker({filename: './webpack-stats-prod.json'}),
// removes a lot of debugging code in React
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}}),
// minifies your code
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
},
beautify: false,
mangle: {
screw_ie8: true,
keep_fname: true
},
compress: {
screw_ie8: true
},
comments: false
})
])
// Add a loader for JSX files
config.module.rules.push({
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: { presets: ['react']}
})
module.exports = config