-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.production.config.js
More file actions
35 lines (27 loc) · 887 Bytes
/
webpack.production.config.js
File metadata and controls
35 lines (27 loc) · 887 Bytes
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
var webpack = require('webpack');
var WebpackStrip = require('strip-loader');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
var prodConfig = require('./webpack.config.js');
const stripLoader = {
test: [/\.js$/, /\.es6$/],
exclude: /node_modules/,
loader: WebpackStrip.loader('eval')
}
prodConfig.devtool = 'source-map';
prodConfig.entry = [
'./js/main.js'
];
prodConfig.module.loaders.push(stripLoader);
//prodConfig.plugins = [new ExtractTextPlugin('[name].css')];
prodConfig.plugins.push(new webpack.DefinePlugin({ // Change flag to prod: for example React uses optimized code better than dev version
'process.env': {
NODE_ENV: JSON.stringify('production')
}
}));
prodConfig.plugins.push(new webpack.optimize.UglifyJsPlugin({
output: {
comments: false,
},
sourceMap: true
}));
module.exports = prodConfig;