-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.js
41 lines (39 loc) · 1.05 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
const { resolve } = require('path');
const zlib = require('zlib');
const { DefinePlugin } = require('webpack');
const CompressionPlugin = require('compression-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const { merge } = require('webpack-merge');
const common = require('./webpack.common');
module.exports = merge(common, {
mode: 'production',
devtool: 'source-map',
output: {
clean: true,
},
plugins: [
new DefinePlugin({
__VERSION__: JSON.stringify(`v${require('./package.json').version}`),
}),
new CompressionPlugin({
test: /\.(js|css|html|svg|data|wasm)$/,
algorithm: 'gzip',
}),
new CompressionPlugin({
algorithm: 'brotliCompress',
test: /\.(js|css|html|svg|data|wasm)$/,
compressionOptions: {
params: {
[zlib.constants.BROTLI_PARAM_QUALITY]: 11,
},
},
threshold: 10240,
}),
new CopyPlugin({
patterns: [
resolve(__dirname, 'public/_headers'),
resolve(__dirname, 'public/.htaccess'),
],
}),
],
});