[Bug]: Cannot import `.ts` files from packages linked with the `file:` protocol using `pnpm`
Version
1.48.0
Steps to reproduce
- Clone repo containing two packages at https://github.com/giacomoran/playwright-loader-ts. The package
package-tsexportssrc/index.tsdirectly; the packagepackage-playwrightdepends onpackage-ts, the dependency is specified with thefile:protocol. cd package-playwrightpnpm installpnpm playwright test- An error should come up
Expected behavior
The tests should run successfully.
Actual behavior
Playwright ESM loader fails to load .ts files from package-ts, which is linked with the file: protocol. The following error comes up:
TypeError: Unknown file extension ".ts" for /Users/giacomoran/Tmp/playwright-loader-ts/package-playwright/node_modules/.pnpm/package-ts@file+..+package-ts/node_modules/package-ts/src/index.ts
The error does not come up by installing the packages with npm instead of pnpm (repo commit https://github.com/giacomoran/playwright-loader-ts/tree/6195d7b3247596b2bdb65995af79c9669bd164cc).
The error does not come up by running npx tsx test.ts, which contains the same import from package-ts as tests/example.spec.ts.
Additional context
Our current workaround is to run:
NODE_OPTIONS="--import tsx" PW_DISABLE_TS_ESM=true pnpm playwright test
Environment
System: OS: macOS 14.6.1 CPU: (12) arm64 Apple M2 Max Memory: 11.26 GB / 96.00 GB Binaries: Node: 20.12.2 - ~/.asdf/installs/nodejs/20.12.2/bin/node Yarn: 1.22.22 - ~/.asdf/installs/nodejs/20.12.2/bin/yarn npm: 10.8.2 - ~/.asdf/plugins/nodejs/shims/npm pnpm: 9.5.0 - ~/.asdf/installs/nodejs/20.12.2/bin/pnpm IDEs: VSCode: 1.90.2 - /opt/homebrew/bin/code Languages: Bash: 5.2.26 - /opt/homebrew/bin/bash
File protocol + pnpm + esm + ts export would be a very narrow use case for us to prioritize. I'll leave it as P3, but it is likely to self-close in 6 months due to lack of interest.
Why was this issue closed?
Thank you for your contribution to our project. This issue has been closed due to its limited upvotes and recent activity, and insufficient feedback for us to effectively act upon. Our priority is to focus on bugs that reflect higher user engagement and have actionable feedback, to ensure our bug database stays manageable.
Should you feel this closure was in error, please create a new issue and reference this one. We're open to revisiting it given increased support or additional clarity. Your understanding and cooperation are greatly appreciated.