You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately the prefersUnplugged key is ignored and all of the optional deps are extracted anyway, because the pkg.conditions !== null check takes precedence over preferUnplugged:
These checks should be in reverse order. By reversing the two checks, everything works: esbuild is unplugged but its optional dependencies are not. When running esbuild, it copies the correct platform-specific binary into its writable, unplugged dir and executes it.
And if you change the location where esbuild stores the platform-specific binary (as I proposed in this PR: evanw/esbuild#2457), it even works with enableScripts: false and nothing unplugged.
To reproduce
mkdir repro &&cd$_
yarn init -2 -y
yarn add esbuild
# should be empty but prints opt dep:
ls .yarn/unplugged | grep -P 'esbuild-(?!(npm))'
FYI esbuild now uses prefersUnplugged: true as of version 0.15.15. Your documentation recommends extracting to node_modules/.cache but your users don't like that as it causes the node_modules directory to be created when it otherwise isn't needed. So to avoid needing to create node_modules/.cache, all of esbuild's platform-specific packages now request to be unplugged.
Yep, followed those developments! Creating node_modules just for .cache, .vite etc is annoying indeed, should've probably been somewhere in .yarn/tmp or so, not to annoy users. Anyway, guess I'll have to live with unplugged esbuild packages :)
Checking in .yarn/unplugged is annoying, but guess the whole 0-installs idea is dying anyway with native deps like esbuild or swc becoming more and more common. Yarn 4 stopped defaulting to 0-installs too I think.
Self-service
Describe the bug
In this comment, esbuild was recommended to add
prefersUnplugged: false
to its optional platform-specific deps so they don't get extracted: #3317 (comment). And indeed, all esbuild variants include thepreferUnplugged
key: https://unpkg.com/browse/esbuild-linux-arm@0.15.3/package.jsonUnfortunately the
prefersUnplugged
key is ignored and all of the optional deps are extracted anyway, because thepkg.conditions !== null
check takes precedence overpreferUnplugged
:berry/packages/plugin-pnp/sources/PnpLinker.ts
Lines 434 to 438 in cf67f3a
These checks should be in reverse order. By reversing the two checks, everything works:
esbuild
is unplugged but its optional dependencies are not. When running esbuild, it copies the correct platform-specific binary into its writable, unplugged dir and executes it.And if you change the location where esbuild stores the platform-specific binary (as I proposed in this PR: evanw/esbuild#2457), it even works with
enableScripts: false
and nothing unplugged.To reproduce
Environment
Additional context
No response
The text was updated successfully, but these errors were encountered: