Skip to content

[Regression]: ESM projects with playwright do not work on Windows #41121

Description

@keegan-conlee-IM

Last Good Version

commit 4d28901

First Bad Version

commit c758b15

Steps to reproduce

  1. Clone https://github.com/keegan-conlee-IM/playwright-trace-mre/tree/module-issue (it's not completely minimal, it's modified from [Bug]: Trace viewer does not capture some dynamically added CSS classes #40895 where I first saw the issue)
  2. Clone the Playwright repo to commit c758b15, build, and point the MRE dependency to it
  3. npm ci and npx playwright install
  4. Try to run the test either from VSCode's test explorer or from npx playwright test

Expected behavior

The test should run and complete successfully

Actual behavior

I see the following error:

Error: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
    at eval (<anonymous>:1:1)

Additional context

I believe I have traced the issue back to commit c758b15. Before this commit the test runs fine. Also, if you change "type": "module" in package.json to "type": "commonjs", the test runs fine.

Environment

System:
    OS: Windows 11 10.0.26100
    CPU: (28) x64 13th Gen Intel(R) Core(TM) i7-13850HX
    Memory: 4.95 GB / 31.69 GB
  Binaries:
    Node: 24.14.0 - C:\nvm4w\nodejs\node.EXE
    Yarn: 1.22.22 - C:\nvm4w\nodejs\yarn.CMD
    npm: 11.9.0 - C:\nvm4w\nodejs\npm.CMD
  IDEs:
    VSCode: 1.108.2 - C:\Program Files\Microsoft VS Code\bin\code.CMD
  Languages:
    Bash: 5.3.9
  npmPackages:
    @playwright/test: file:../playwright/packages/playwright-test => 1.61.0-next

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions