-
Notifications
You must be signed in to change notification settings - Fork 25
/
vue.config.js
31 lines (29 loc) · 889 Bytes
/
vue.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
const CompressionPlugin = require('compression-webpack-plugin')
const zopfli = require('@gfx/zopfli')
const { GenerateSW } = require('workbox-webpack-plugin')
let plugins = []
if (process.env.NODE_ENV === 'production') {
const compressionTest =
/\.(js|css|json|txt|html|ico|svg|png|jpg|jpeg)(\?.*)?$/i
plugins = [
new CompressionPlugin({
algorithm(input, compressionOptions, callback) {
return zopfli.gzip(input, compressionOptions, callback)
},
compressionOptions: {
numiterations: 15,
},
minRatio: 0.99,
test: compressionTest,
}),
new GenerateSW({
swDest: 'iuri.is-sw.js',
}),
]
}
module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',
configureWebpack: {
plugins,
},
}