Skip to content
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?]: Different node_modules layout on Node.js 23 when enableTransparentWorkspaces is false #6567

Open
1 task
JLHwung opened this issue Oct 21, 2024 · 2 comments
Assignees
Labels
bug Something isn't working node-modules

Comments

@JLHwung
Copy link
Contributor

JLHwung commented Oct 21, 2024

Self-service

  • I'd be willing to implement a fix

Describe the bug

Yarn 4.3.1 generated different nm layout on Node.js 23 when enableTransparentWorkspaces is false. I also tested on Yarn 4.5.1, the nm layout is identical to yarn 4.3.1.

To reproduce

git clone https://github.com/babel/babel && cd babel
nvm use 23 && rm -rf node_modules && yarn install
find ./node_modules -type d -print | sort > nm-23.txt

nvm use 22 && rm -rf node_modules && yarn install
find ./node_modules -type d -print | sort > nm-22.txt

diff nm-22.txt nm-23.txt

Expected: there are no differences between these two file. As there are no differences when running yarn on node.js 22 vs node.js 20.

Actual: Their are differences from @babel/* packages, and it seems that yarn 4 on Node.js 23 are hoisting less packages to the top level than Node.js 22/20.

Environment

System:
OS: macOS 14.7
CPU: (10) arm64 Apple M1 Max
Binaries:
Node: 20.13.1 - /private/var/folders/qq/f33w791j6wgb405mt9lgpw3w0000gn/T/xfs-b5fa2615/node
Yarn: 4.5.1 - /private/var/folders/qq/f33w791j6wgb405mt9lgpw3w0000gn/T/xfs-b5fa2615/yarn
npm: 10.5.2 - ~/.nvm/versions/node/v20.13.1/bin/npm
bun: 0.5.1 - ~/.bun/bin/bun
npmPackages:
jest: ^30.0.0-alpha.2 => 30.0.0-alpha.2

Additional context

This issue currently blocks babel/babel#16912.

@JLHwung JLHwung added the bug Something isn't working label Oct 21, 2024
@JLHwung
Copy link
Contributor Author

JLHwung commented Oct 21, 2024

It seems that the behaviour on Node.js 23 actually does more good to the Babel repo than the upgrade disruption: We have nailed several unsound imports that won't be revealed unless pnp mode is enabled. At this time this issue no longer blocks Babel's adaption to Node.js 23.

@larixer larixer self-assigned this Oct 21, 2024
@JLHwung
Copy link
Contributor Author

JLHwung commented Oct 21, 2024

I guess this issue might be related to nodejs/node#55410. If yarn used path.resolve internally, then the behaviour change in node 23 might prevent yarn hoisting some packages. Hopefully it will be reverted in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node-modules
Projects
None yet
Development

No branches or pull requests

2 participants