-
-
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
[Bug?]: Dynamic import does not use the PnP API when importing a ESM from CommonJS #4045
Comments
import()
doesn’t use the PNP loader when called from a VS Code extensionimport()
doesn’t use the PNP loader when called from CommonJS
import()
doesn’t use the PNP loader when called from CommonJS
It's because the PnP linker explicitly lists
The solution would be to remove it but maybe @arcanis remembers why its there |
That’s not true, the script within I think the problem really has to do with node’s import behavior, as the error only happens when trying to dynamically import Since the SDK folder thing is demonstrably unrelated to this, I took the liberty to change the title back. |
Thanks! I actually did And forgot to search for |
The XO VSCode doesn't work with yarn PNP out of the box. Someone found a solution by createing a patched node runtime that can be used to run XO. xojs/vscode-linter-xo#71 flying-sheep/react-color-scheme-switch#3 yarnpkg/berry#4045 I added the XO plugin to the recommended VSCode extensions and added a workspace config to automatically enable it for the project.
Self-service
Describe the bug
Trying to use the https://github.com/xojs/vscode-linter-xo extension with yarn 2, I ran into problems in the past, see #3708. With nodejs 17.4, one blocker is gone, but it doesn’t work yet:
The yarn PNP loader doesn’t seem to be used when a dynamic import from a commonjs module imports a ESM like in this dynamic import:
To reproduce
Sadly I don’t think reproducing using sherlock is possible, as this requires running
node
withNODE_OPTIONS
set, and sherlock doesn’t seem to support that. I made a reproducer in https://github.com/flying-sheep/repro-yarn-xogit clone https://github.com/flying-sheep/repro-yarn-xo.git && cd repro-yarn-xo
yarn start
(i.e.bash .yarn/sdks/xo/node.sh import-xo.js
)See the following error:
Environment
Additional context
No response
The text was updated successfully, but these errors were encountered: