x)- [ ] bug report -> please search issues before submitting
- [x ] feature request
@angular/cli: 1.0.1
node: 6.7.0
os: win32 x64
There is a way to customize the hash in the name of distribution files (main.{hash}.bundle.js )?
Right now it creates different random hash for each file but I need to define it by me (maybe the timestamp or date when created) in order to upload it to a CDN and keep track of different production deployment versions, this way I could make a quick rollback to previous versions.
The hash is representative of the content of the file. When the content changes the hash changes. This enables efficient long term caching of an application. Only the files that actually change between versions will need to be downloaded by a client.
As a sidenote -- I have tried to implement a "check for update" in my application. I want to periodically see if a new version is available on the server and then offer to reload the application.
What I came up with is look at the src of the main.<guid>.bundle.js and have a REST query to the server that looks at the current index.html and returns that <guid> for comparison.
It works fine -- provided the main bundle is updated by the build process. Obviously it isn't always and neither are the other bundles referenced from the main bundle due to most code being in lazily loaded modules.
Any idea how to reliably detect changes?
Closing because the usecase for the feature request is already addressed (as per @clydin's description).
@achimha I guess you can find the 'true' build info in stats.json (ng build --stats-json). You can parse it to obtain the list of bundles and make some decisions based on that:
"assetsByChunkName": {
"polyfills": "polyfills.3739fab150c80116bab8.bundle.js",
"main": "main.55a91853af04e84a36b3.bundle.js",
"styles": "styles.d41d8cd98f00b204e980.bundle.css",
"vendor": "vendor.0984ee69d7d5dff8c67f.bundle.js",
"inline": "inline.471dd61aa8a5f32a71db.bundle.js"
},
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
The hash is representative of the content of the file. When the content changes the hash changes. This enables efficient long term caching of an application. Only the files that actually change between versions will need to be downloaded by a client.