Skip to content

Commit

Permalink
brotli compression
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Apr 5, 2020
1 parent 79381d3 commit c566103
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 1 deletion.
136 changes: 136 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"@vue/eslint-config-prettier": "^6.0.0",
"@vue/eslint-config-typescript": "^5.0.2",
"@vue/test-utils": "1.0.0-beta.32",
"compression-webpack-plugin": "^3.1.0",
"csstype": "^2.6.10",
"eslint": "^6.8.0",
"eslint-plugin-prettier": "^3.1.2",
Expand Down
15 changes: 14 additions & 1 deletion vue.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const CompressionPlugin = require('compression-webpack-plugin')
const https = require('https')
const keepAliveAgent = new https.Agent({ keepAlive: true })

Expand All @@ -20,7 +21,19 @@ module.exports = {
module: {
rules: []
},
plugins: []
plugins:
process.env.NODE_ENV === 'production'
? [
new CompressionPlugin({
filename: '[path].br[query]',
algorithm: 'brotliCompress',
test: /\.(js|css|html|svg|json)$/,
compressionOptions: { level: 11 },
minRatio: 1,
deleteOriginalAssets: false
})
]
: []
},

chainWebpack: config => {
Expand Down

0 comments on commit c566103

Please sign in to comment.