Bundle module loader code is generated before all bundle rev hashes are computed
See original GitHub issueI’m submitting a bug report
- Library Version: 0.26.0
Please tell us about your environment:
-
Operating System: OSX 10.11.6
-
Node Version: 7.7.1
- NPM Version: 4.1.2
-
Browser: all
-
Language: ESNext
Current behavior: (I’ve tried to articulate this as clearly as possible, but it’s tricky. I’ll try to stay on top of replies, if there is anything you’d like to clarify).
When the rev
option is enabled for a project composed of multiple bundles, it’s possible for the bundler to write the loader code for the “configTarget” bundle (i.e the app’s entry point) before it has computed and stored the hash for all other bundles referenced in the loaderConfig.
This means that the module loading config created in loader.js:createRequireJSConfig
(for example) will contain paths that lack hashes, which causes 404 errors when trying to load bundles.
(I can reproduce this very consistently, so I don’t think it’s an issue around the determinism of which bundles are processed in what order).
Expected/desired behavior:
-
What is the expected behavior? The loader configuration produced by loader.js should contain hashes for all bundles. This means they must be computed before the loader config is created, which means that the “configTarget” bundle’s hash depends on the hashes of all bundles included in the module loader config, and so it must be computed last or be recomputed afterwards.
-
What is the motivation / use case for changing the behavior? The aurelia bundling system is powerful and flexible enough to make splitting code into multiple bundles worth thinking about. Cache-busting capabilities are vital for deploying bundled code like this. The current behaviour of this feature seems incorrect, and so we must either jam everything into a single bundle or use a non content-aware version of cache-busting.
I believe this issue was slightly improved in #489, but this only ensure that the computed hash takes into account the current bundle, not all bundles.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
@AStoker: Thanks for the support. I’m pretty sure this was a version thing after all - failed to reproduce it on my own machine on a fresh project after updating versions as you suggested. Always fun to report a bug for something that was literally just fixed…
I was starting to assume my config was the issue, as I was including a setting for options.rev for each bundle in my config and this felt like pushing my luck. But because of 6a93f2ebe8053f293f88afedb2e50807c7d886b7 I can seemingly do this now, so thanks for that!
For kicks and giggles, just go ourside your project directory, and run the following commands exactly (this will remove the cli globally and reinstall it to the latest version).
(make sure you have that
aurelia-cli
andau
as the uninstall command) After that, try running your command again. If you still have the project, can you create a repo that I can look at? If it’s still breaking, it sounds more like a config problem.