/
wm-custom-webpack.config.js
37 lines (37 loc) · 1.09 KB
/
wm-custom-webpack.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
34
35
36
37
const CompressionPlugin = require(`compression-webpack-plugin`);
const BrotliPlugin = require(`brotli-webpack-plugin`);
const path = require(`path`);
module.exports = {
resolve:{
alias:{
themes: path.resolve(__dirname,`src/assets/themes/`)
}
},
plugins:[
new BrotliPlugin({
asset: '[fileWithoutExt].br.[ext]',
test: /\.(js|css|html|svg|txt|eot|otf|ttf|gif)$/
}),
new CompressionPlugin({
test: /\.(js|css|html|svg|txt|eot|otf|ttf|gif)$/,
filename(info){
let opFile= info.path.split('.'),
opFileType = opFile.pop(),
opFileName = opFile.join('.');
return `${opFileName}.gzip.${opFileType}`;
}
})
],
optimization: {
splitChunks: {
automaticNameDelimiter:'-',
cacheGroups: {
vendor: {
minSize: 1000000,
maxSize: 1000000,
test: /[\\/]node_modules(?![\\/]wm)[\\/]/
}
}
}
}
}