-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.prod.js
More file actions
50 lines (49 loc) · 1.18 KB
/
webpack.prod.js
File metadata and controls
50 lines (49 loc) · 1.18 KB
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
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const { DefinePlugin } = require('webpack');
require('dotenv').config();
module.exports = merge(common, {
mode: 'production',
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
output: {
comments: false
}
},
extractComments: false
}),
new OptimizeCSSAssetsPlugin({})
],
splitChunks: {
chunks: 'all',
minSize: 10000,
maxSize: 250000,
minChunks: 1,
maxAsyncRequests: 5,
maxInitialRequests: 3,
automaticNameDelimiter: '.',
automaticNameMaxLength: 30,
cacheGroups: {
vendors: {
test: /[\\/]node_modules[\\/]/,
priority: 1
},
default: {
minChunks: 2,
priority: 0,
reuseExistingChunk: true
},
name: 'vendors'
}
}
},
plugins: [
new DefinePlugin({
API_BASE_DOMAIN: JSON.stringify(process.env.API_BASE_DOMAIN)
})
]
});