Skip to content

Instantly share code, notes, and snippets.

@bmeck
Created February 22, 2018 19:27
Show Gist options
  • Save bmeck/64fa74ff0dff3713f63381363469f728 to your computer and use it in GitHub Desktop.
Save bmeck/64fa74ff0dff3713f63381363469f728 to your computer and use it in GitHub Desktop.

ESM do not have a way to setup modules that are aliases of other modules

ESM in in browsers cannot reliably use export * from to act as an alias since it may alter the shape of the namespace they are importing, nor can they use HTTP redirects which are treated as new module records.

Adding default to the list of exports from export * from has been revisted and rejected. I have to take extra effort to use export * reliably as a means to create pass through modules. Typically involving resolving, fetching, and parsing the source text of a dependency outside of VM control. This can be seen in projects where I am invoking http/file access and parsing to AST to figure out if the module being delegated to has a default.

In addition using export * is also not suitable to be used as a pass through mechanism since it does not replace the module namespace of the source text it appears in.

I would like to propose a syntax to alleviate concerns of pass through modules.

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