简体   繁体   中英

How to enable gzip compression on production build in angular 12?

1.Integrated new web.config.js for gzip compression, https://i.stack.imgur.com/MuVt4.png

2.Updated angular.json file, "build": { "builder": "@angular-builders/custom-webpack:browser", "options": { "outputPath": "dist", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.app.json", "customWebpackConfig": { "path": "./webpack.config.js" },

dist files are compressed with.gz extention and but it is not reflecting on browser after deployment.

3.'content-encoding:gzip' is not showing on browser.network response header, https://i.stack.imgur.com/nkSoV.png .

is there anything to handle on server side for enabling this?

if you are using web servers like apache / nginx you can enable gz compression on your web server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM