-
-
Notifications
You must be signed in to change notification settings - Fork 167
Expand file tree
/
Copy pathwebpack.production-config.js
More file actions
28 lines (23 loc) · 933 Bytes
/
webpack.production-config.js
File metadata and controls
28 lines (23 loc) · 933 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
/* eslint-disable */
// Set global environment to production, to trigger the use of an optimized
// Redux build
// process.env.NODE_ENV = 'production';
var dl = require('datalib'),
webpack = require('webpack'),
ExtractTextPlugin = require('extract-text-webpack-plugin'),
devCfg = require('./webpack.config'),
prodCfg = dl.extend({}, devCfg, {devtool: 'cheap-module-source-map'}),
rules = prodCfg.module.rules;
// Extract stylesheet.
rules[1].use = ExtractTextPlugin.extract({fallback: 'style-loader', use: ['css-loader', 'sass-loader']});
// Add a DefinePlugin instance to hard-set global environment to "production",
// to trigger the use of an optimized Redux build, etc.
prodCfg.plugins.push.apply(prodCfg.plugins, [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
}),
new ExtractTextPlugin({filename: 'style.css'}),
]);
module.exports = prodCfg;