Closed timmorey closed 4 years ago
The root issue here appears to be down in broccoli-asset-rev: https://github.com/rickharrison/broccoli-asset-rev/issues/29, but looks unlikely to get fixed there.
Resolved with https://github.com/Esri/ember-cli-amd/pull/60
The amd-loading.js script does not always get a unique fingerprint at build time, which can break deployments to environments that simultaneously host multiple revisions (for example the lightning deploy strategy). In particular, when a revision contains only changes to the app or vendor js files, the amd-loading.js script will not get a unique fingerprint.
This can be reproduced in the dummy app included in this addon:
ember build -e production
). This will produce assets like<div>hello world</div>
to the application.hbs template.Notice that the dummy.js file got a unique fingerprint here, but the amd-loading.js fingerprint is the same as in the previous build, even though the new amd-loading script correctly references the new dummy script.
If we were to then deploy both of these revisions to a hosting environment, both would end up loading the same dummy.js file -- the two revisions will not be able to coexist. Thus the deployment is broken.
The fingerprint of the amd-loading script will only be changed when the amd imports in the app are changed.
I believe this is due to the way fingerprinting is done in ember-cli. Fingerprints are first computed for all assets, and then the asset files are later re-written to preserve references to other fingerprinted assets. So, a new fingerprint on the dummy.js or vendor.js file does not lead to a new fingerprint on the amd-loading.js file.
Our team uses the lightning deploy strategy in our QA environments where we host many revisions at once for different lines of development. We also use this strategy in the production hosting for one of our apps. For the time being, we have reverted to using ember-cli-amd 2.x, since it appears that 3.x is incompatible with the deployment strategy. However, we would like to update to 3.x so we can benefit from other changes happening here.
One solution might be to provide an option to inline amd-loading.js into index.html at build time for use cases that are dependent on unique fingerprints.