Skip to content

Exports subpath wildcard patterns issue. #352

@scott-lc

Description

@scott-lc

Referring to the Node subpath patterns documentation, notice how a pattern can specify a file extension (in this example .js) on both sides of the pattern mapping:

{
  "exports": {
    "./features/*.js": "./src/features/*.js"
  }
}

According to the Node docs,

Including the "*.js" on both sides of the mapping restricts the exposed package exports to only JS files.

However, this does not work in enhanced-resolved. The wildcard pattern without a file extension works fine, for example:

{
  "exports": {
    "./features/*": "./src/features/*"
  }
}

But adding a wildcard file extension does not work. To test this, simply add the following test case to test/exportFields.js:

// ./test/exportFields.js
const testCases = [
  //...
  {
    name: "This will fail!",
    expect: ["./src/features/file.js"],
    suite: [
	{
	  "./features/*.js": "./src/features/*.js"
	},
	"./features/file.js",
	[]
    ]
  }

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