endojs / endo

Endo is a distributed secure JavaScript sandbox, based on SES
Apache License 2.0
762 stars 68 forks source link

Compartment mapper should take first matching of conditional exports #2276

Closed kriskowal closed 1 month ago

kriskowal commented 1 month ago

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 and default and note that default wins.

Expected behavior

The first match (node in the example) should win.

kriskowal commented 1 month ago

This fix is necessary for progress toward native XS support #400.