-
-
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): esm - return undefined source for commonjs #5677
Conversation
How can I repro the problem ? |
Use Node.js nightly and run |
8aafe09
to
e19fd0c
Compare
That's what I did, but as of 62b2cf30f2d1326dde9d4bc047f5611f17c4a20f I couldn't repro 🤔 |
I tested with nodejs/node@2557932 but can also reproduce with nodejs/node@62b2cf3. |
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
};
} |
**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.
**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.
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