fix(pnp): esm - return undefined source for commonjs#5677
Merged
Conversation
Member
|
How can I repro the problem ? |
Member
Author
|
Use Node.js nightly and run |
8aafe09 to
e19fd0c
Compare
Member
|
That's what I did, but as of 62b2cf30f2d1326dde9d4bc047f5611f17c4a20f I couldn't repro 🤔 |
Member
Author
|
I tested with nodejs/node@2557932 but can also reproduce with nodejs/node@62b2cf3. |
Member
|
Indeed; a minimal repro is: import fs from 'fs';
import {fileURLToPath} from 'url';
export async function load(urlString, context, nextLoad) {
return {
format: `commonjs`,
source: fs.readFileSync(fileURLToPath(urlString), `utf8`),
shortCircuit: true
};
} |
Member
merceyz
added a commit
that referenced
this pull request
Aug 23, 2023
**What's the problem this PR addresses?** The ESM loader always returns a source which after nodejs/node#47999 landed causes stuff to break. **How did you fix it?** Return undefined source for commonjs modules **Checklist** - [x] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). - [x] I have set the packages that need to be released for my changes to be effective. - [x] I will check that all automated PR checks pass before the PR gets reviewed.
merceyz
added a commit
that referenced
this pull request
Aug 23, 2023
**What's the problem this PR addresses?** The ESM loader always returns a source which after nodejs/node#47999 landed causes stuff to break. **How did you fix it?** Return undefined source for commonjs modules **Checklist** - [x] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). - [x] I have set the packages that need to be released for my changes to be effective. - [x] I will check that all automated PR checks pass before the PR gets reviewed.
This was referenced Sep 11, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's the problem this PR addresses?
The ESM loader always returns a source which after nodejs/node#47999 landed causes stuff to break.
How did you fix it?
Return undefined source for commonjs modules
Checklist