-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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(pnp): always initialize the ESM loader when enabled #3667
Conversation
170b32a
to
c920355
Compare
); | ||
|
||
test( | ||
`it should always set default as module.exports when importing a commonjs file`, |
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.
Quick note: it's worth adding a (in-PR) comment when tests are removed, explaining why they aren't relevant anymore (were they bugged?) 😃
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 documented it in the commit that removed them
These tests checked that the code generation was correct but the code generation was replaced with a patch to the `fs` bindings
d314792
to
d868c7f
Compare
Could this be released to canary? |
Sure, running it now https://github.com/yarnpkg/berry/actions/runs/1468300994 Alternatively you can get it from sources yarn set version from sources |
Looks like that has failed: https://github.com/yarnpkg/berry/runs/4229011500?check_suite_focus=true#step:7:1257 |
The publish to the registry failed but yarn set version canary |
The extensionless file workaround for nodejs/node#33226 in this PR doesn't work when I'm attempting to load an entrypoint with an arbitrary file extension that's intended to be parsed by a Are there any gotchas to renaming the |
Could you open a seperate issue to track that?
We don't want to deviate from how Node behaves more than we have to so we could only do that for the entrypoint |
I'm experiencing an analogous issue that this PR doesn't seem to be fixing. I'm trying to use the
Which setting Yarn's version from sources or using canary doesn't fix. |
Please open a bug report with a reproduction |
What's the problem this PR addresses?
Dynamic imports doesn't work in commonjs files when the entrypoint is also a commonjs module.
Fixes #3671
Fixes #3687
Fixes PnP support in the Babel repo (cc @nicolo-ribaudo)
Fixes (part of) the failing Angular e2e test
How did you fix it?
node --loader
treats entrypoint as ESM when should be loaded as CJS nodejs/node#33226), this allows removing the patch torequire('module').runMain
. Removing that patch lets Node initialize the loader regardless of the module typeprocess.mainModule
when the commonjs module is already in the cache when loading the main moduleChecklist