Versions
Angular CLI: 1.6.8
Node: 8.9.4
OS: win32 x64
Angular: 5.2.9
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cdk: 5.2.4
@angular/cli: 1.6.8
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.8
@schematics/angular: 0.1.17
typescript: 2.6.1
webpack: 3.10.0
Repro steps
ng build --prod --build-optimizer=false --vendor-chunk
Observed behavior
and run previous command for instance 3 times, note the hashes:
> ng build --prod --build-optimizer=false --vendor-chunk
Node#moveTo was deprecated. Use Container#append.
Date: 2018-04-05T17:37:06.484Z
Hash: 6567769b926051187dab
Time: 57784ms
chunk {0} 0.016a9bf2be18abb170c1.chunk.js () 277 kB [rendered]
chunk {1} main.e0d0b3bda5f04942944e.bundle.js (main) 2.94 MB [initial] [rendered]
chunk {2} polyfills.71070f1467b9cb77b8e5.bundle.js (polyfills) 98 kB [initial] [rendered]
chunk {3} styles.cd345cc5c6bcd7bb27a3.bundle.css (styles) 57.9 kB [initial] [rendered]
chunk {4} vendor.d630d3fc882739714918.bundle.js (vendor) 13.8 kB [initial] [rendered]
chunk {5} inline.527949f9a57d47da562e.bundle.js (inline) 1.49 kB [entry] [rendered]
> ng build --prod --build-optimizer=false --vendor-chunk
Node#moveTo was deprecated. Use Container#append.
Date: 2018-04-05T17:39:00.912Z
Hash: 45003e7908aa536afe88
Time: 65516ms
chunk {0} 0.016a9bf2be18abb170c1.chunk.js () 277 kB [rendered]
chunk {1} main.9dc9feff3e3f630123f0.bundle.js (main) 2.94 MB [initial] [rendered]
chunk {2} polyfills.71070f1467b9cb77b8e5.bundle.js (polyfills) 98 kB [initial] [rendered]
chunk {3} styles.cd345cc5c6bcd7bb27a3.bundle.css (styles) 57.9 kB [initial] [rendered]
chunk {4} vendor.d630d3fc882739714918.bundle.js (vendor) 13.8 kB [initial] [rendered]
chunk {5} inline.052178568c89a21b8291.bundle.js (inline) 1.49 kB [entry] [rendered]
and the last one after done changes in styles files, vendor and polyfills files. also and for main file but it's regenerates each time
> ng build --prod --build-optimizer=false --vendor-chunk
Node#moveTo was deprecated. Use Container#append.
Date: 2018-04-05T17:55:53.295Z
Hash: 3d6edf77a1bf5bb2e071
Time: 55952ms
chunk {0} 0.016a9bf2be18abb170c1.chunk.js () 277 kB [rendered]
chunk {1} main.b8a947f8ae3a97cc3727.bundle.js (main) 2.94 MB [initial] [rendered]
chunk {2} polyfills.71070f1467b9cb77b8e5.bundle.js (polyfills) 98 kB [initial] [rendered]
chunk {3} styles.cd345cc5c6bcd7bb27a3.bundle.css (styles) 57.9 kB [initial] [rendered]
chunk {4} vendor.d630d3fc882739714918.bundle.js (vendor) 13.8 kB [initial] [rendered]
chunk {5} inline.009d2384a8e227c15045.bundle.js (inline) 1.49 kB [entry] [rendered]
Desired behavior
I didn't understand what's the correct behavior in case of angular-cli to generate new hashes for every file or not but anyway they are regenerated by some obscure principle.
as you can see there is a very dangerous behavior. somehow angular-cli generates the same hashes for chunks, styles, vendor and polyfills files even if they are changed.
as for me the process of generating hashes must be under a user control (!)
I've spent a lot of time to parse generated files, I meant index.html and inline.js in purpose for cache during deployment process.
at least in the end, a user should get different hashes.
Versions
Repro steps
ng build --prod --build-optimizer=false --vendor-chunkObserved behavior
and run previous command for instance 3 times, note the hashes:
and the last one after done changes in
stylesfiles,vendorandpolyfillsfiles. also and formainfile but it's regenerates each timeDesired behavior
I didn't understand what's the correct behavior in case of angular-cli to generate new hashes for every file or not but anyway they are regenerated by some obscure principle.
as you can see there is a very dangerous behavior. somehow angular-cli generates the same hashes for
chunks,styles,vendorandpolyfillsfiles even if they are changed.as for me the process of generating hashes must be under a user control (!)
I've spent a lot of time to parse generated files, I meant
index.htmlandinline.jsin purpose for cache during deployment process.at least in the end, a user should get different hashes.