-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.production.js
44 lines (41 loc) · 1.21 KB
/
webpack.production.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 merge = require('webpack-merge')
const common = require('./webpack.common.js')
const webpack = require('webpack')
const MinifyPlugin = require('babel-minify-webpack-plugin')
const ExtractTextPlugin = require("extract-text-webpack-plugin")
const HtmlPlugin = require('html-webpack-plugin')
const htmlPlugin = new HtmlPlugin({
template: './index.production.html',
filename: 'index.html',
inject: 'body'
})
const extractSass = new ExtractTextPlugin({
filename: "app.bundle.css"
});
module.exports = merge(common, {
plugins: [
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new MinifyPlugin({}, { comments: false }),
extractSass,
htmlPlugin
],
module: {
rules: [{
test: /\.scss$/,
use: extractSass.extract({
use: [{
loader: "css-loader?minimize"
}, {
loader: "sass-loader"
}],
// use style-loader in development
fallback: "style-loader"
})
}]
}
});