8 ms·
Basically package.json but without package.json. IE no bundle JS is back. There are still some issues, specifically with things like React, where it's kind of
by randall 3y ago
Basically package.json but without package.json. IE no bundle JS is back.
There are still some issues, specifically with things like React, where it's kind of hard to guarantee if you use React, you'll get the same version if you use it in "react-relay" etc.
Deno has been very informative on this. They're adding package.json support to the runtime as a polyfill, but I'm hopeful they can swing back to import maps fully over time.
- galaxyLogic 3y agoI see. So the benefit is that you externalize your imports into a file separate from you code. Right? I can see the benefit of that. It is like meta-data about your module, kept separate from it. And several modules can use the same imports-map, right? That means amount of code needed gets less. Thanks for the explanation. I assume I got it right, did I? Or now I wonder, must the imports-map be defined in the same module where it is used?
- WorldMaker 3y agoNo, you might have one "global" importmap in your HTML file and that applies to the entire graph of modules you load after that, which also means that you can "chain" importmaps and can also do things like pin the versions of dependencies of dependencies in that top level importmap. That sort of thing will need package-management-like tooling and dependency "packages" built for it, but that gets back to the idea that importmaps in theory are a lighter weight replacement for package.json/package-lock.json files.
- TimTheTinker 3y agoIt also allows easy loading of micro-frontends, if that's the architecture you're shooting for. https://single-spa.js.org/docs/recommended-setup/ https://single-spa.js.org/docs/recommended-setup/