-
-
Notifications
You must be signed in to change notification settings - Fork 185
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
pathFilter
(or some new API) should support implementations of exports
#253
Comments
That would be great to enable, until we add support natively.
|
|
resolve is ubiquitous enough that i'll be maintaining both v1 and v2 (which is already out in prereleases, but could still gain breaking changes) for the foreseeable future. The main issue is that if in v1, you disabled the lookup and also enabled the new "exports" logic, we'd have to throw. Certainly if you have enough information already, that would be ideal :-) making |
Ok, gave it a whack over in jestjs/jest#11961
Not 100% if that's correct, but it seems to work... 😅 |
Seems fine - part of the reason |
Right, it breaks a test, but I think that test is faulty (it imports a "local" module with a package.json with Might just roll this out behind a config flag and hope people test it and report instances where it behaves wrong (after adding more tests) |
Would be nice to have some way of disabling |
Once we have true "exports" support, it'll take precedence over the "main" anyways, so you won't need to ignore that. |
Yeah, figured it'd make more sense to go straight there instead of some intermediary step 🙂 |
Hmm no, hit a case I forgot to add a test for 😀 Of course... See jestjs/jest#12373, any help appreciated! 😀 Happy to send a PR to this repo if we figure out how to solve it. I think |
Ok, closing again 🙈 My solution is to pop of anything trailing after (code is in above PR if this explanation made no sense, which it probably doesn't) |
In lieu of this module supporting
exports
out of the box, it would be awesome if consumers could use its existing capabilities (packageFilter
,pathFilter
etc.) to implement support forexports
on the consumer side.I have experimented a bit with this, and from what I can tell there are 2 issues:
resolve
addsindex
if a directory is specified (resolve/lib/sync.js
Line 192 in f1b5184
index
is not specified by the user as changing it to.
(which is what a directory means inexports
) is not necessarily a safe operation. Not sure how to mitigate this in a way that's backwards compatible.pathFilter
which works great forrequire('some-module/thing')
, but it doesn't work forrequire('./some-thing')
from within a module. Relative imports within a module isn't restricted byexports
, butpathFilter
cannot know if the resolution request is for a relative file or not. A solution here is maybe to include a flag saying if it's relative within the package or not?The text was updated successfully, but these errors were encountered: