-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.prod.config.js
33 lines (31 loc) · 1.07 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
const path = require('path');
const webpack = require('webpack');
const HtmlwebpackPlugin = require('html-webpack-plugin');
const merge = require('webpack-merge')
const baseConfig = require('./webpack.base.config.js')
const ROOT_PATH = path.resolve(__dirname);
const SRC_PATH = path.resolve(ROOT_PATH, 'src');
const prodConfig = merge(baseConfig, {
plugins: [
new webpack.DefinePlugin({
'process.env.API_ENV': '"production"'
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
}),
new HtmlwebpackPlugin({
title: 'react-webpack-demo',
filename: 'index.html',
template: path.resolve(SRC_PATH, 'templates', 'index.html'),
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
removeAttributeQuotes: true
}
})
]
});
module.exports = prodConfig;