-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.prod.config.js
40 lines (34 loc) · 1.11 KB
/
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
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const constants = require('./webpack-constants');
const webpackConfig = require('./webpack.config.js');
const { plugins } = webpackConfig;
const { loaders } = webpackConfig.module;
module.exports = Object.assign({}, webpackConfig, {
module: {
loaders: [{
test: /\.js$/,
exclude: /node_modules/,
loaders: ['babel']
}].concat(loaders)
},
plugins: plugins.concat(
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new HtmlWebpackPlugin({
template: './templates/index.ejs',
inject: false,
minify: {
collapseWhitespace: true,
removeComments: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
},
serviceWorker: `/${constants.SERVICE_WORKER_FILENAME}`
})
)
});