New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flat hashing model for import maps #3407
Comments
https://github.com/jakearchibald/rollup-import-maps-demo. The main thing to note is I had to reimplement hashing. It'd be good if I could use Rollup's hashing implementation, along with the placeholder implementation. Of course, a custom URL map built on top of AMD/SystemJS would be an order of magnitude more complicated. |
Ok, this is important but will require some thought. In theory, most could be done from plugins today but it could be tedious and error-prone and you could not easily support that asset hashes still consider their dependencies.
Sure, it could be a To sketch around the problem, a file can now have two names: The actual file name but also a different name under which it is referenced in some places; the other name would come from the import map. There are several ways to play that:
And maybe there are more, for now I would see this as being in brainstorming stage. By the way, SystemJS has builtin import map support https://github.com/systemjs/systemjs/blob/master/docs/import-maps.md For AMD, I guess some work would be necessary. Maybe a feature for the next iteration of |
I wrote a plugin that leverages SystemJS's import maps https://gist.github.com/jakearchibald/ee75c204a5fead04672f3046d1fe27d3. The main difference here is the handling of assets. With chunks, hashing is disabled in Rollup and handled manually, whereas with assets hashing is used and 'undone' within This is fragile because I'm assuming a lot about where the hash is within the file, but it works pretty well! |
I wish I've seen this before I started working on not very pretty but working proof of concept ;) |
Feature Use Case
Since hashing is being rethrought, I wanted to provide some requirements for import maps (and similar systems).
By "import map", I mean any of:
Right now, if a leaf module changes, it's hash changes. This means anything which imports it needs to change its hash, to update the reference to the leaf module. This goes all the way up, meaning a small change
Feature Proposal
With a file map, the caching pattern changes:
utils-4a13b1c2.js
andutils.js
. This applies to both chunks and assets.My proposal is just: Make sure the above possible 😀.
I'll create a demo for import maps showing the current state of things and provide feedback.
The text was updated successfully, but these errors were encountered: