Skip to content

[node-resolve] does not support both *.js and * exports #1605

Description

@shirotech

There was meant to be a fix here #1549 but it doesn't fully fix the issue.

It works if you only have 1 star export, but it you have multiple, it doesn't pick up the right one.

For example this works:

{
  "exports": {
    "./*.js": "./dist/*.js"
  }
}

but this doesn't

{
  "exports": {
    "./*.js": "./dist/*.js",
    "./*": "./dist/*.js"
  }
}
  • Rollup Plugin Name: node-resolve
  • Rollup Plugin Version: 15.2.3
  • Rollup Version: 4.0.2
  • Operating System (or Browser): Mac
  • Node Version: 18

Expected Behavior

Expected to resolve the one matched first in top-to-bottom order

Actual Behavior

Only the last pattern is picked up, and gives wrong paths, resulting in duplicate extension i.e. .js.js

Additional Information

Sorry, I could not provide a repro as I couldn't find a public example package in a short amount of time. But the issue seems obvious and a prompt fix will mostly be appreciated by the community.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions