-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.prod.js
49 lines (48 loc) · 1.33 KB
/
webpack.config.prod.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
45
46
47
48
49
var webpack = require('webpack');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const merge = require('webpack-merge');
const commonConfig = require('./webpack.config.common');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = merge(commonConfig, {
entry: {
vendor: ['react', 'lodash'],
app: './src/index.tsx'
},
devtool: 'source-map',
optimization: {
splitChunks: {
cacheGroups: { //https://github.com/webpack/webpack/tree/master/examples/multiple-entry-points
commons: {
name: "commons",
chunks: "initial",
minChunks: 2,
minSize: 0
}
}
},
occurrenceOrder: true, // To keep filename consistent between splits
minimizer: [
new UglifyJSPlugin({
sourceMap: true, // this is a bug in https://github.com/webpack/webpack/issues/6614#issuecomment-369376775
uglifyOptions: {
compress: {
drop_console: true,
}
}
})
]
},
plugins: [
new ExtractTextPlugin({
filename: '[name].[chunkhash].css',
allChunks: true
}),
new HtmlWebpackPlugin({
title: 'App',
template: './index.prod.html',
filename: './index.html'
}),
new webpack.HashedModuleIdsPlugin()
]
});