-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
fix: correctly resolve remapped directories #12373
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
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
| // We require from this crazy path so that we can mimick Jest (and its | ||
| // transitive deps) being installed alongside a projects deps (e.g. with an | ||
| // 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
resolvetries to find a directory, and when there's a mapping, that doesn't exist. Not sure how, butresolveneeds 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 beforeresolvechecks if it's on disk. Currently neitherpackageFilternorpathFilteris called beforeresolvesthrowsMODULE_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
exportsto.or is absolute)package.jsonfrom root usingresolvesopathsetc is respectedexportsexist, resolve it and return the absolute pathresolvelookup, like we had before feat: support.inexportsfield #11919 and feat: supportexportsinpackage.json#11961Fixes #12372
Test plan
Green CI
(eventually)