Open yoavweiss opened 3 months ago
We're eagerly waiting for that proposal to be fleshed out. For now our solution to that problem is publishing on JSR. With JSR each library can have their own import map. Other than that there isn't another option at the moment. We're waiting for the proposal you linked to, to be finished to support nested import maps outside of JSR and npm packages.
That's great to hear!! FWIW, I feel the proposal has already gotten a lot of feedback and is in good shape. I also have a Chromium implementation going, but that is just starting its review process.
Hi. The multiple import maps proposal has merged! Now we have a standard way to import ES modules using other maps and merge them in the main import map. That's a huge leap forward for HTTP imports and dependencies dedupe.
@oscarotero could you please link to the relevant proposal change? I'm having trouble finding it.
@bartlomieju This is the link to the new section https://html.spec.whatwg.org/multipage/webappapis.html#merge-existing-and-new-import-maps
And the pull request where you can see the changes and conversation: https://github.com/whatwg/html/pull/10528
Import maps currently have to load before any ES module and there can only be a single import map per document. That makes them fragile and potentially slow to use in real-life scenarios: Any module that loads before them breaks the entire app, and in apps with many modules the become a large blocking resource, as the entire map for all possible modules needs to load first.
There's an HTML PR proposal to enable multiple import maps per document, by merging them in a consistent and deterministic way.
I'd appreciate y'all's opinions.