Skip to content

module: add import map support#50590

Draft
wesleytodd wants to merge 1 commit intonodejs:mainfrom
wesleytodd:import-maps
Draft

module: add import map support#50590
wesleytodd wants to merge 1 commit intonodejs:mainfrom
wesleytodd:import-maps

Conversation

@wesleytodd
Copy link
Copy Markdown
Member

@wesleytodd wesleytodd commented Nov 7, 2023

This PR adds experimental support for import maps behind the --experimental-import-map=<path> flag. This is a draft as I believe there are still quite a few things to discuss and add:

  • Docs
  • More test coverage
    • Test on the module tree from some of the bundled deps
    • Use web platform tests
  • Benchmarks (specifically to see how much adding an import map hits startup)
  • Bare specifier remapping: Should we have the ability to remap one bare specifier to another? foo to bar and then have default resolution on bar, for example? This might be against spec, but also seems really helpful.
  • Does it make sense to resolve the import map via esm? Or should we do a more basic file read?
  • In the future should we plan to automatically load an import map based on a well known location? (ex node_modules/importmap.json)
  • What types of values do we want for --experimental-import-map? Right now any module specifier is allowed, but do we want that? This was done to enable http import of import maps, but that is not explicitly a goal, just a starting point for discussion.
  • CommonJS support? What do we want to do about that?
    • Decided we should hold off on that and deal with it in a follow up PR if we think we should do it.
  • module: add import map support #50590 (comment) Do we need to pass the import map reference to loaders? If not, can we remove it from context first to avoid the non-transferable problem?
  • Address the concern here about how import map generation is intended to work

Helpful links:

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

esm Issues and PRs related to the ECMAScript Modules implementation. lib / src Issues and PRs related to general changes in the lib or src directory. loaders Issues and PRs related to ES module loaders module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.