fix: add preferUnplugged to package.json#129
Conversation
|
|
Thanks for the clarification, I have updated my statement. |
|
Looking at version Lines 598 to 599 in adbffcd I really don't want to add any PnP related logic in this package. |
|
@AriPerkkio Fair enough. That’s why I’m proposing adding support for the package’s default behavior under Yarn PnP via preferUnplugged. At the very least, I want it to work with the default Node module resolution out of the box. |
|
Yes, I missed that part. After taking a closer look, the issue actually comes from the fact that tinypool is esm and the child_process fork by extension uses esm module resolution. The setupEnv from yarnpkg/sdks is missing This means the issue in that PR can likely be fixed entirely on that side, so this PR may not be necessary. That said, the main point of this PR still stands but I’m fine with closing it if you prefer that. |
AriPerkkio
left a comment
There was a problem hiding this comment.
The setupEnv from yarnpkg/sdks is missing
--loaderflag so the resolution fail.
As this sounds like it's an ESM related issue on Yarn PnP side, I don't think adding package manager feature specific work-arounds in downstream packages is good idea.
And as this is not related to the earlier discussed process.env.NODE_OPTIONS in any way, let's close this PR without merging.
Ah yes, I missed that. I still think the fact that |
|
I agree. No idea why |
Problem
Right now, the default behaviour of tinypool with child process runtime will always break in yarn PnP environment. End-user can either mark this package as unplugged to let fork resolves process.js correctly with builtin node module resolution or pass
NODE_OPTIONSto Tinypool constructor options (and by extension, tochild_process.fork()) to allow it to resolve process.js with yarn PnP resolution.Reproduction
https://github.com/slainless/tinypool-reproduction
To fix the reproduction, just run
yarn unplug tinypool.To test
preferUnpluggedon distribution:yarn linkto local tinypool from repro repository then change protocol fromportal:tofile:yarn installSolution
The most unobstrusive fix is to mark tinypool as
preferUnplugged. This should fix the default child process runtime behaviour in yarn PnP environment and release end-user from responsibility of passing NODE_OPTIONS or marking it as unplugged per project basis.The actual motivation for this PR is actually to unblock oxc integration (which uses tinypool):