Closed
Description
I looked at this library briefly when I implemented this feature for esbuild and discovered some bugs. One of them is that it looks like this library doesn't handle *
wildcards correctly when there are multiple wildcards:
const re = require('resolve.exports')
const pkg = {
exports: {
"./dir*": "./*sub/dir*/file.js"
}
}
console.log(re.resolve(pkg, 'dirtest'))
Expected output:
./testsub/dirtest/file.js
Observed output:
./testsub/dir*/file.js
The relevant part from the spec is this one:
- If pattern is true, then
- Return the URL resolution of resolvedTarget with every instance of "*" replaced with subpath.
Other bugs I found included #7 and missing validation checks. I wasn't sure whether to also file a bug about the missing validation checks since you could argue that it's potentially not a concern of this library, although if many tools are adopting this package then it would probably make sense to put the validation checks in one place instead of replicating them in the various projects.
Metadata
Metadata
Assignees
Labels
No labels