I've come across this issue for a long time, and now I'm kinda being forced to solve this. The issue is, whenever I create a new build of the angular app. It doesn't refresh the client browser (cached files). I run this command to build: npm run build -- --aot --output-hashing=all (I've also tried ng run appname:build --aot --output-hashing=all). And this happens:
First build:
Initial Chunk Files | Names | Size
vendor.2eda81f6456c17909e24.js | vendor | 12.06 MB
main.b535ef0c91d4eb282427.js | main | 10.15 MB
scripts.5148d950c7658ce5ffcc.js | scripts | 9.84 MB
styles.b53c3890ac51003121cc.css | styles | 654.45 kB
polyfills.a7d71f1da262b2c41b61.js | polyfills | 149.77 kB
runtime.364de6dc78d0f591319b.js | runtime | 9.17 kB
| Initial Total | 32.85 MB
Lazy Chunk Files | Names | Size
canvg.932b5e456ff864f69502.js | canvg | 448.70 kB
html2canvas.631fb3a52e4d89cbeadc.js | html2canvas | 431.41 kB
dompurify.14b67489952758eedea9.js | dompurify | 60.58 kB
Build at: 2022-09-22T19:34:09.309Z - Hash: 3b75f4585b72b110d28e - Time: 55372ms
Second Build:
Initial Chunk Files | Names | Size
vendor.2eda81f6456c17909e24.js | vendor | 12.06 MB
main.b535ef0c91d4eb282427.js | main | 10.15 MB
scripts.5148d950c7658ce5ffcc.js | scripts | 9.84 MB
styles.b53c3890ac51003121cc.css | styles | 654.45 kB
polyfills.a7d71f1da262b2c41b61.js | polyfills | 149.77 kB
runtime.364de6dc78d0f591319b.js | runtime | 9.17 kB
| Initial Total | 32.85 MB
Lazy Chunk Files | Names | Size
canvg.932b5e456ff864f69502.js | canvg | 448.70 kB
html2canvas.631fb3a52e4d89cbeadc.js | html2canvas | 431.41 kB
dompurify.14b67489952758eedea9.js | dompurify | 60.58 kB
Build at: 2022-09-22T19:35:33.043Z - Hash: 3b75f4585b72b110d28e - Time: 57324ms
All the chunk files have the exact same name, so the browser never bursts the cache. I'm using 11.0.3 angular.
angular.json build configurations:
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}