enhanced-resolve
enhanced-resolve copied to clipboard
Exports subpath wildcard patterns issue.
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",
[]
]
}
Sounds like a bug, do you want send a fix?
Fixed by https://github.com/webpack/enhanced-resolve/pull/353