Namespaces are not disambiguated by star exports #53707
Labels
confirmed-bug
Issues with confirmed bugs.
esm
Issues and PRs related to the ECMAScript Modules implementation.
loaders
Issues and PRs related to ES module loaders
v8 engine
Issues and PRs related to the V8 dependency.
Version
v22.4.0
Platform
Subsystem
loaders
What steps will reproduce the bug?
This set of files reproduces. Execute
entry.mjs
to observe.This line embeds the above files in a graph of data URLs to reproduce in a snippet. Firefox also succeeds on this one.
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
Different paths to the same module namespace should be disambiguated and load successfully.
This is the behavior specified in ECMAScript:
The relevant logic is
ResolveExport
. This line toward the bottom defines the star export / namespace interaction:If either but not both are
namespace
, it's ambiguous. If both arenamespace
the end result is to disambiguate and consider them identical.Node.js does disambiguate values within modules:
Firefox also disambiguates module namespaces. This file succeeds:
Object { value: 'Curiouser and curiouser.' }
What do you see instead?
SyntaxError: The requested module './aggregate.mjs' contains conflicting star exports for name 'substance'
Additional information
There's a GitHub repo here with discussion.
https://github.com/bojavou/disambiguate-namespace
The text was updated successfully, but these errors were encountered: