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
Node.js package conditional imports should take the entries under the first matching tag and ignore all subsequent tags. This is hinted with the express advice that default must appear last if present.
Steps to reproduce
Create a bundle from a package that has conditional exports e.g., endo and default and note that default wins.
Expected behavior
The first match (node in the example) should win.
The text was updated successfully, but these errors were encountered:
…rts (#2275)
Closes: #2276
## Description
If a `package.json` `"exports"` is a list of ordered constraints, Endo’s
Compartment Mapper currently uses all of the accepted entries and not
just the first. This causes subsequent entries to override the first if
they produce matching paths. I believe the intended behavior is to use
the first that matches.
### Security Considerations
This amounts to a difference in behavior between Endo and Node in the
treatment of Package Exports.
### Scaling Considerations
None.
### Documentation Considerations
Fixing this issue will bring Endo into accord with Node.js’s somewhat
light documentation on this feature.
### Testing Considerations
Existing snapshot tests cover the behavior and must be updated to
reflect the correct interpretation.
### Compatibility Considerations
This will improve ecosystem compatibility. No known bundles depend on
the existing behavior, but we cannot rule out the possibility.
There is a possibility that this change will break existing bundles that
depend on the current erroneous behavior, for example preferring
`default` over an `endo` tag. I am considering this a bugfix and not a
breaking change since it is a bug to rely on the current behavior.
### Upgrade Considerations
Even if this behavior might break the bundling process for existing
contracts, it will not invalidate existing bundles. This change should
not break upgrades but may create a speed bump for upgrading tool
dependencies.
Describe the bug
Node.js package conditional imports should take the entries under the first matching tag and ignore all subsequent tags. This is hinted with the express advice that
default
must appear last if present.Steps to reproduce
Create a bundle from a package that has conditional exports e.g.,
endo
anddefault
and note thatdefault
wins.Expected behavior
The first match (
node
in the example) should win.The text was updated successfully, but these errors were encountered: