question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bundle module loader code is generated before all bundle rev hashes are computed

See original GitHub issue

I’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:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
chriswaitcommented, Mar 9, 2017

@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!

0reactions
AStokercommented, Mar 8, 2017

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).

npm uninstall -g aurelia-cli au
npm cache clean
npm install -g aurelia-cli

(make sure you have that aurelia-cli and au 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack bundles my files in the wrong order ... - Stack Overflow
Webpack creates bundle.js with all of its application code ... So I imported it with script-loader like this: import '.
Read more >
What is Bundle.module? | Apple Developer Forums
I see that Apple developer use Bundle.module in Resources and ... with Bundle.module and you can see generated code for searching your module...
Read more >
Caching - webpack
This guide focuses on the configuration needed to ensure files produced by webpack compilation can remain cached unless their content has changed. Output ......
Read more >
Adding Hashes to Filenames - SurviveJS
Starting from version 5, webpack is using a deterministic way of generating filenames that's a good compromise between bundle size and long time...
Read more >
TPM 2.0 Part 1 - Architecture - Trusted Computing Group
THIS SPECIFICATION IS PROVIDED "AS IS" WITH NO EXPRESS OR IMPLIED WARRANTIES. WHATSOEVER, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR FITNESS ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found