-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.js
52 lines (51 loc) · 1.47 KB
/
webpack.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
50
51
52
const merge = require("webpack-merge");
const WorkboxPlugin = require("workbox-webpack-plugin");
const common = require("./webpack.common.js");
const webpack = require("webpack");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const CompressionPlugin = require("compression-webpack-plugin");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
.BundleAnalyzerPlugin;
module.exports = merge(common, {
mode: "production",
optimization: {
minimizer: [new UglifyJsPlugin()],
splitChunks: {
cacheGroups: {
default: false,
vendors: false,
vendor: {
name: "vendor-1",
chunks: "all",
test: /[\\/]node_modules[\\/](react|react-.+|apollo-.+|ramda|formik|react-router-dom|styled-components|lodash|amazon-cognito-identity-js|styled-system)[\\/]/,
priority: 20
},
vendor2: {
name: "vendor-2",
chunks: "all",
test: /[\\/]node_modules[\\/]()[\\/]/,
priority: 20
},
common: {
name: "common",
minChunks: 2,
chunks: "async",
priority: 10,
reuseExistingChunk: true,
enforce: true
}
}
}
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
new WorkboxPlugin.GenerateSW({
clientsClaim: true,
skipWaiting: true
})
// new BundleAnalyzerPlugin()
// new CompressionPlugin({
// filename: "[path]"
// })
]
});