You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 2, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 2, 2023. It is now read-only.
Import Maps are currently being stripped down to a more minimal spec an implementation. See the in-progress PR here - WICG/import-maps#176, which removes support for array fallbacks.
We've currently followed the import maps spec compatibility by allowing "exports" targets to be arrays following the similar fallbacks pattern, but this should be reconsidered now that import maps are changing.
My concern though is that I think it is important that it should be possible to use "exports" to provide mappings that are browser-specific, and previously this was being marked to be implemented through an array fallback-like approach.
If we ship "exports" without a way to provide browser-specific exports, then we would effectively be encouraging userland to come up with solutions like "exports.browser" etc etc. which ends up causing the same issue as the "main"-proliferation issue we had before.
Questions:
Do we remove array fallbacks in Node.js now as well?
Are we happy with userland coming up with custom "exports" solutions through new package.json fields for other environment-specific mappings or do we want to create a new space for something here?
My personal take is: As long as we can map the data in exports to a reasonable "today import map", assuming a modern build tool, we shouldn't be blocked by import map iterations. We'll hopefully be able to leverage future features in import maps themselves (potentially even using them directly in node) but for now we have good reasons to support existing use cases covered by require & today's ecosystem.
Is one possible reading of your 2nd question "Should we rename exports to entries to officially disassociate them from import maps?"? I'd still hope that we would keep it "import maps compatible" but I can see the appeal.
Aside: By "import maps compatible" I mean that with environmental data like a browserslist and process.env values etc. a tool could turn the data into a simple string-to-string import map to be used in a browser.
Import Maps are currently being stripped down to a more minimal spec an implementation. See the in-progress PR here - WICG/import-maps#176, which removes support for array fallbacks.
We've currently followed the import maps spec compatibility by allowing
"exports"targets to be arrays following the similar fallbacks pattern, but this should be reconsidered now that import maps are changing.My concern though is that I think it is important that it should be possible to use
"exports"to provide mappings that are browser-specific, and previously this was being marked to be implemented through an array fallback-like approach.See for example, the package targets proposal which was aiming to fill this gap - https://github.com/guybedford/proposal-pkg-targets#target-maps.
If we ship
"exports"without a way to provide browser-specific exports, then we would effectively be encouraging userland to come up with solutions like"exports.browser"etc etc. which ends up causing the same issue as the"main"-proliferation issue we had before.Questions: