-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
productionGzip in vue cli 3.0 #978
Comments
Probably no, as most static servers have gzip capabilities. You can easily add this yourself using |
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = ['js', 'css']
configureWebpack: {
plugins: [
new CompressionWebpackPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
threshold: 10240,
minRatio: 0.8
})
]
} |
@realeve 我试了,但是没有将.gz文件注入进index.html,不知道有什么好的方法吗? |
@aloneweb .gzip文件不是注入index.html的。 在服务端没有开启gzip的情况下,读取一个js/css文件,如果存在其.gzip版本则服务器优先返回压缩的文件,前台拿到后在浏览器层面解压。 我这里开gzip纯粹是为了看一下文件实际传输大小是多大,尽可能优化体积,同时服务端也是把gzip默认华人打开了的。 |
@realeve 懂了,非常感谢大佬的解答 👍 |
To do this right and optimally, there is more code to this than I would care to maintain. Would appreciate if this was built into Vue CLI 3. Ideally, you'd support Zopfli for better GZIP compression and Brotli too which requires three dependencies alltogether.
|
Not success at begining,found that compression-webpack-plugin option “asset” has been changed to “filename” at last version 2.0.0,For avoiding confusion |
@ayizhi Thank you very much ! |
For any one using this #978 (comment)
|
With node 11.7.0+ compression-webpack-plugin has native support for brotli |
This package has been deprecated |
What problem does this feature solve?
no productionGzip config after cli 3.0, would it be add?
What does the proposed API look like?
productionGzip: on
The text was updated successfully, but these errors were encountered: