Skip to content

fix(deps): declare playwright-core as direct dependency#397

Merged
pavelfeldman merged 1 commit intomicrosoft:mainfrom
av1155:fix/pnpm-isolated-resolution
May 4, 2026
Merged

fix(deps): declare playwright-core as direct dependency#397
pavelfeldman merged 1 commit intomicrosoft:mainfrom
av1155:fix/pnpm-isolated-resolution

Conversation

@av1155
Copy link
Copy Markdown
Contributor

@av1155 av1155 commented May 4, 2026

Summary

  • playwright-cli.js does require('playwright-core/lib/tools/cli-client/program') but package.json only declares playwright. Under pnpm's default isolated node-linker, the require walk fails on every fresh install (Cannot find module 'playwright-core/lib/tools/cli-client/program').
  • Add playwright-core to dependencies, pinned to the same 1.60.0-alpha-1777669338000 as playwright. The existing transitive resolution stays the same, npm-hoisted layouts are unaffected, and isolated-layout installs (pnpm, pnp) now resolve correctly.
  • Same shape as @playwright/test's cli.js, which declares playwright as a direct dep because it does require('playwright/lib/program'). playwright-core already lists ./lib/tools/cli-client/program in its exports field; declaring playwright-core directly here keeps package.json in sync with the require.

Test plan

  • Removed nodeLinker: hoisted from the global pnpm config so the default isolated layout was active for the comparison.
  • pnpm install -g @playwright/cli@latest (current npm latest) crashes as above.
  • npm pack of this branch then pnpm install -g ./playwright-cli-0.1.11.tgz produces a working install: playwright-cli --version returns 0.1.11, playwright-cli open https://example.com loads the page and captures a snapshot.
  • Regression check: same tarball under npm install resolves cleanly (no change to hoisted-layout behavior).
  • npm test passes (tests/integration.spec.ts: open data URL, 1 passed).

Fixes #396

@av1155
Copy link
Copy Markdown
Contributor Author

av1155 commented May 4, 2026

@microsoft-github-policy-service agree

playwright-cli.js requires `playwright-core/lib/tools/cli-client/program`
but only `playwright` is declared as a dependency. Under package
managers that isolate transitives (pnpm with the default `isolated`
linker), the require fails immediately on every install. Pinning
`playwright-core` to the same version as `playwright` removes the
dependency on hoisting and matches the existing transitive resolution.

Fixes microsoft#396
@av1155 av1155 force-pushed the fix/pnpm-isolated-resolution branch from c54b1b4 to 385dbfb Compare May 4, 2026 06:03
@av1155 av1155 changed the title fix: declare playwright-core as a direct dependency fix(deps): declare playwright-core as direct dependency May 4, 2026
@pavelfeldman pavelfeldman merged commit fb2a027 into microsoft:main May 4, 2026
3 of 4 checks passed
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.

[Bug]: pnpm install -g fails with Cannot find module 'playwright-core/lib/tools/cli-client/program'

2 participants