Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] "Cannot import a typescript file from an esmodule" #13191

Closed
jeremytenjo opened this issue Mar 30, 2022 · 9 comments
Closed

[BUG] "Cannot import a typescript file from an esmodule" #13191

jeremytenjo opened this issue Mar 30, 2022 · 9 comments

Comments

@jeremytenjo
Copy link

Context:

  • Playwright Version: [1.20.1]
  • Operating System: [ Mac]
    System:
    OS: macOS 12.3
    Memory: 115.30 MB / 16.00 GB
    Binaries:
    Node: 15.14.0 - ~/.nvm/versions/node/v15.14.0/bin/node
    npm: 6.14.13 - ~/.nvm/versions/node/v15.14.0/bin/npm
    Languages:
    Bash: 3.2.57 - /bin/bash

Describe the bug

Getting Cannot import a typescript file from an esmodule when running npx playwright test

This issue only happens on version 1.20.1. I fix it by going back to version 1.20.0

@rwoll
Copy link
Member

rwoll commented Mar 31, 2022

Can you link to a repo that we can clone and run and observe the error? This will ensure we are debugging based on the correct information/package.json.


This might be related to #13078 which was recently resolved on main branch.

You can try with the upcoming version by doing:

$ npm i @playwright/test@next && npx playwright install && npx playwright test

Let us know how it goes!

@rwoll rwoll added the triaging label Mar 31, 2022
@DoisKoh
Copy link

DoisKoh commented Mar 31, 2022

I'm getting this on 1.20.1 and not 1.20.0 as well.

svelte-kit, 1.0.0-next.303

@rwoll
Copy link
Member

rwoll commented Mar 31, 2022

Does it work if you do:

$ npm i @playwright/test@next && npx playwright install && npx playwright test

@DoisKoh
Copy link

DoisKoh commented Apr 1, 2022

Hello, sorry for the late reply.

Yes it does work. Note: It requires the playwright.config.js file to be renamed to playwright.config.ts (which thankfully, is mentioned in the output upon execution).

@rwoll
Copy link
Member

rwoll commented Apr 1, 2022

Thanks for the update! 1.20.2 will be released soon, and it will include the fix. In the interim, you can stay on 1.20.0 or depend on the @next version that worked for you.

@rwoll rwoll closed this as completed Apr 1, 2022
@jeremytenjo
Copy link
Author

Fixed for me as well. Thanks for the help! @rwoll

@khaki32
Copy link

khaki32 commented Jun 10, 2022

I created a new project using npm init svelte and I'm still getting this error when running the test command, despite the playwright version being 1.22.2

@rwoll
Copy link
Member

rwoll commented Jun 10, 2022

@khaki32 Can you file a new issue to be triaged? Please include a link to a repo of your test project we can clone and download to observe the error! Thanks!

@ghost
Copy link

ghost commented Jun 15, 2022

npm run test does not work... error with playwright
REPRODUCING STEPS:
npm init svelte (choose Typescript, choose Demo App)
npm run test

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

No branches or pull requests

4 participants