Skip to content

fix(playwright): separate ESM/CJS loader compilation cache entries fixes 41662#41667

Closed
ahfoysal wants to merge 1 commit into
microsoft:mainfrom
ahfoysal:fix/41662-compilation-cache-mode-key
Closed

fix(playwright): separate ESM/CJS loader compilation cache entries fixes 41662#41667
ahfoysal wants to merge 1 commit into
microsoft:mainfrom
ahfoysal:fix/41662-compilation-cache-mode-key

Conversation

@ahfoysal

@ahfoysal ahfoysal commented Jul 7, 2026

Copy link
Copy Markdown

Why

Fixes cache collisions between ESM and CJS loader transforms when loading the same workspace module in both module formats.

What changed

  • Use a mode-aware compilation cache key (esm\0filename vs cjs\0filename) for in-memory cache entries.
  • Keep existing persisted cache format stable and normalize keys in getUserData() output.
  • Add regression test should keep ESM and CJS loader compilation cache separate for workspace modules in tests/playwright-test/loader.spec.ts covering globalSetup + config requiring the same workspace package.

Validation

  • npm run -s ttest -- --grep "ESM and CJS" (not runnable here: @playwright/test stable-test-runner module missing)
  • npm run -s tsc -- -p packages/playwright/tsconfig.json --pretty false --noEmit (not runnable here: tsc unavailable without local install)

Issue

Fixes #41662

@yury-s yury-s requested a review from dgozman July 8, 2026 22:52
@dgozman

dgozman commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Decided to not fix this, see issue for more details.

@dgozman dgozman closed this Jul 9, 2026
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.

[Regression]: Unexpected token import / export when a .mts config imports a workspace package that is also required transitively by globalSetup

2 participants