-
-
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?]: Yarn pnp fails with synckit and prettier plugin in eslint context #6335
Comments
The problem seems to be a dynamic import in worker.js in the package eslint-plugin-prettier. I tried a few fixes and I could only get it to work using require. Dynamic import seems to lock up the node process.
|
It works with node 18.18.2 (microsoft/vscode-eslint#1856 (comment)) I'm not sure if these debug logs are helpful but this is what i did as well (microsoft/vscode-eslint#1856 (comment)) |
I tested this again and the steps provided makes it hang for me. I tested this under Ubuntu 22.04 in case this makes a difference. |
Hangs for me under Windows as well. |
@arcanis is there anything I can capture that might help you to understand what is going on? |
Yes and no. The Node.js ESM loader implementation is quite fluctuating, so bugs sometimes appear and get fixed on later versions (for instance some 22.x versions introduce a deadlock with some other loaders). As a result problems are very rarely about PnP itself, but more the APIs we're given to integrate with ESM in Node.
I managed to repro - I was running |
The relevant error here is visible when running Digging into the source code, I see that this error is thrown by a worker thread spawned just so eslint-plugin-prettier can synchronously and conditionally require prettier. The SDK doesn't currently inject the As for the deadlock, I have no idea - given that it works after running |
Do you know why, when it's unplugged, the dynamic import still doesn't seem to work but it does work when you change it to |
Because the Node.js ESM loader pipeline is still broken 😞 Digging into the issue, it seems the I opened an issue on SyncKit (un-ts/synckit#174) to suggest a workaround. |
sorry if this is just noise, but I believe I'm seeing a similar issue when stylelint/vscode-stylelint#464 (comment)
The module loads when |
Hi @arcanis, Any updates on this? It seems the un-ts/synckit#174 issue has been fixed |
@agarwalvaibhav0211 yes it has been fixed with latest release of "resolutions": {
"synckit": "^0.9.1"
} |
[email protected] has bumped synckit to |
Self-service
Describe the bug
Yarn pnp can't load synckit worker hence prettier plugin fails to run.
Why do I file this against yarn? Everything works as expected when installing the dependencies with npm.
To reproduce
Use NodeJS
20.9.0
Clone https://github.com/shermify/eslint-plugin-repro
Setting the NODE_PATH is equivalent to setting the VS Code eslint.nodePath setting.
start node REPL and execute the following commands (to ensure to mimic the executing since a VS Code extension):
We will load the eslint npm module from .yarn/sdks
Observe: the promise never resolves. You can't even terminate NodeJS using
Ctrl+C
. You have to kill it.I debugged it in the context of the VS Code ESLint extension and the findings are here: microsoft/vscode-eslint#1856 (comment) and in the following comments.
Environment
System:
OS: Linux 5.15 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700K
Binaries:
Node: 20.9.0 - /tmp/xfs-426f4fe7/node
Yarn: 4.3.0 - /tmp/xfs-426f4fe7/yarn
npm: 10.1.0 - ~/.nvs/default/bin/npm
pnpm: 9.1.1 - /usr/local/share/npm-global/bin/pnpm
Additional context
No response
The text was updated successfully, but these errors were encountered: