Skip to content

fix(node): Read module versions from the pnpm isolated layout - #25526

Open
JPeer264 wants to merge 1 commit into
developfrom
jp/node-modules-pnpm-isolated
Open

JPeer264 wants to merge 1 commit into
developfrom
jp/node-modules-pnpm-isolated

Conversation

@JPeer264

Copy link
Copy Markdown
Member

This fixes modulesIntegration for CJS apps that pnpm installs with its default isolated layout. The integration reads the version of each module in require.cache from its package.json, but only for packages directly in a node_modules folder of the app. pnpm keeps them in node_modules/.pnpm/<package id>/node_modules/<name>, so event.modules had only the version ranges from the app's package.json. Now it has the installed versions, and also the packages that the app does not declare, like with npm and Yarn.

The new suites/modules test writes a package into this layout, because the monorepo installs with the hoisted layout.

@JPeer264
JPeer264 added this pull request to stack #25528 October 19, 2026 13:44
`modulesIntegration` reads the version of each CJS module in
`require.cache` from its package.json in a node_modules folder of the
main module. The isolated pnpm layout keeps the package files in
`node_modules/.pnpm/<package id>/node_modules/<name>`, so the
integration found no version there. Events got only the version ranges
from the app's package.json, and no packages that the app does not
declare.

Read these folders like the node_modules folders of the main module.
The new test writes a package into this layout, because the monorepo
installs its packages with the hoisted layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JPeer264
JPeer264 force-pushed the jp/node-modules-pnpm-isolated branch from aab2593 to 220ad81 Compare October 19, 2026 14:33
@JPeer264
JPeer264 marked this pull request as ready for review October 19, 2026 14:57
@JPeer264
JPeer264 requested a review from a team as a code owner October 19, 2026 14:57
@JPeer264
JPeer264 requested review from isaacs and mydea and removed request for a team October 19, 2026 14:57
@JPeer264 JPeer264 self-assigned this Oct 19, 2026
@JPeer264
JPeer264 requested review from andreiborza and s1gr1d and removed request for mydea October 19, 2026 14:57

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant