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
Respect package.json#exports
when resolving plugins
#14110
Respect package.json#exports
when resolving plugins
#14110
Conversation
} | ||
return res.value; | ||
} | ||
async function resolveStandardizedNameForImport( |
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 kept these two functions separated (rather than creating a gensync) because they are not simply a sync and an async version: the sync one is also used when Babel is called asynchronously.
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/50740/ |
The author of
I think we can first try the native |
70db994
to
0232e1f
Compare
|
66229ba
to
ced9928
Compare
I can reproduce the Jest failure locally, using The failure is that it segfaluts 😢 |
I hate it, it's nodejs/node#35889 for the millionth time. It's the dynamic import used to get the built-in
@SimenB Is there a way to detect if we are running in |
Currently, no. We could add something to
Definitely interested! Would you be able to open an issue over in the jest repo about it? If you meant a more private conversation that's possible as well, of course 🙂 Just DM me on twitter |
Maybe I can check if
Sure, I'll DM you (I might then open an issue, but it might end up being a lot of work for nothing)! |
We load some of our libraries inside of the sandbox, and in order to have access to the "real" globals in cases where users do |
* Use native import.meta.resolve when available
f29c2c4
to
ac045cf
Compare
I had a demo code like this:
and I noticed that it resolved to the CJS version of
babel-plugin-polyfill-corejs3
, even if@babel/core
internally usesimport()
to load it.This PR fixes that, by using the correct resolution algorithm for ESM. I used
require.resolve
for CJS and https://github.com/wooorm/import-meta-resolve for ESM (which is an exact copy of the experimentalimport.meta.resolve
Node.js API).Unfortunately that package is published as ESM, so we cannot directly depend on it. I added a gulp task to add it as a (
.gitignore
d) file in oursrc
folder, so that we can then compile it to CJS.The vendored file has this MIT license + copyright (inlined in a comment)