-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Bug]: Jest does not correctly resolve wildcards in subpath imports #15250
Comments
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Bump |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
This is a bug in const { imports } = require('resolve.exports');
const resolved = imports({
'imports': {
'#test/*.css': './src/*.css',
'#test/*.ts': './src/*.ts',
},
}, '#test/asdf/css.ts');
console.log(resolved); Logs out Mind opening up an issue there? If I delete the |
Shouldn't the fix be to use require.resolve or import.meta.resolve instead? This way it is using Node.js's module resolution instead of a third-party library's. |
No, we cannot configure that to work with e.g. browser resolution or I've tried many times to get node to expose their resolution algorithm, but they're not particularly interested in it |
Node.js feature requests for the same: |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Version
29.7.0
Steps to reproduce
See https://github.com/JavaScriptBach/jest-repro
Expected behavior
When a subpath import with a wildcard is defined, Jest does not correctly resolve it.
For example, if I define
Then an import of
#test/asdf/css.ts
should resolve to./src/asdf/css.ts
.Actual behavior
Instead, Jest resolves it to
./src/asdf.css
.Additional context
My envinfo below is macOS, but this issue also happens on Linux.
Environment
The text was updated successfully, but these errors were encountered: