-
-
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
fix: correctly resolve remapped directories #12373
Conversation
I'm pretty unclear on the problem. When you say "remapped", do you mean like, jest config that's trying to map one folder path to another? |
When (Unsure if link works, but look at diff in |
ahh, right. yeah this is one of the bigger stumbling blocks i've ran into for resolve's implementation :-/ i don't have any easy solutions |
Right, none of the hooks (except |
From looking at https://nodejs.org/api/modules.html#all-together, and specifically |
Have a somewhat working version of that now, but it fails when |
d193498
to
c8c6981
Compare
pushed up my half-working code, if by chance somebody comes over this and gives it a try before I get back to it myself 😀 |
5bec21e
to
1385905
Compare
// NPM3 flat dep tree) | ||
const jestUtil = require('../../../packages/jest-util'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I honestly don't understand this test 🙈 Comes from #1572
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment above doesn't make much sense, you're not simulating a real environment by using a relative path to get into some module
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Old OP
For now, just a failing test.
The issue is that
resolve
tries to find a directory, and when there's a mapping, that doesn't exist. Not sure how, butresolve
needs to find the closest package.json first, load it, pass it through filters, then try to request from disk. Or something like it - we need to map the request beforeresolve
checks if it's on disk. Currently neitherpackageFilter
norpathFilter
is called beforeresolves
throwsMODULE_NOT_FOUND
.https://github.com/browserify/resolve/blob/8641b137f5fc1c4d40164c3aae7f4e492c332e42/lib/sync.js#L207-L220
/cc @ljharb any ideas on best approach here?
Rewrites the logic that respects
exports
to.
or is absolute)package.json
from root usingresolve
sopaths
etc is respectedexports
exist, resolve it and return the absolute pathresolve
lookup, like we had before feat: support.
inexports
field #11919 and feat: supportexports
inpackage.json
#11961Fixes #12372
Test plan
Green CI
(eventually)