Description
Which @angular/* package(s) are the source of the bug?
service-worker
Is this a regression?
No
Description
From the Service Worker Documentation:
The version identifier of the application is determined by the contents of all resources, and it changes if any of them change. In practice, the version is determined by the contents of the ngsw.json file, which includes hashes for all known content. If any of the cached files change, the file's hash changes in ngsw.json. This change causes the Angular service worker to treat the active set of files as a new version.
Assuming that the refered hash is the one included in VersionReadyEvent.latestVersion.hash
, this is currently not the case. From my testing, each build results in a new version hash even if a) the build hash is the same and b) the hashTable
of ngsw.json is the same. (So effectively, the only thing that changes in ngsw.json is the timestamp
property)
This in turn causes SwUpdate to detect unnecessary updates with no changes.
Update:
As I suspected it is the timestamp
in ngsw.json that is affecting the version hash. Removing the timestamp or setting it to a fixed value in the built app will result in the versioning working as documented.