Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exports subpath wildcard patterns issue. #352

Closed
scott-lc opened this issue Jul 25, 2022 · 2 comments
Closed

Exports subpath wildcard patterns issue. #352

scott-lc opened this issue Jul 25, 2022 · 2 comments

Comments

@scott-lc
Copy link

scott-lc commented Jul 25, 2022

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",
	[]
    ]
  }
@scott-lc scott-lc changed the title Subpath wildcard patterns issue. Exports subpath wildcard patterns issue. Jul 25, 2022
@alexander-akait
Copy link
Member

Sounds like a bug, do you want send a fix?

@alexander-akait
Copy link
Member

Fixed by #353

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants