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] ESM: imports don't work [ERR_MODULE_NOT_FOUND] and [ERR_UNSUPPORTED_DIR_IMPORT] #13515

Closed
ebeloded opened this issue Apr 13, 2022 · 1 comment · Fixed by #13567
Closed
Assignees

Comments

@ebeloded
Copy link

ebeloded commented Apr 13, 2022

Context:

  • Playwright Version: 1.21.0
  • Operating System: Mac
  • Node.js version: 16
  • New empty project created with create-playwright
  • set type="module" in package.json

Code Snippet

// import from ./file.ts
import { b } from './file' // [ERR_MODULE_NOT_FOUND]
// import from a folder/index.ts
import { a } from './folder' // [ERR_UNSUPPORTED_DIR_IMPORT]

Describe the bug

In ESM project (TypeScript) imports don't work

Reproduction repo: https://github.com/ebeloded/playwright-13515

@dgozman
Copy link
Contributor

dgozman commented Apr 14, 2022

@ebeloded You should either import { b } from './file.ts' or import { b } from './file.js'. Refer to this comment for more details. Let us know whether this works for you.

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 a pull request may close this issue.

4 participants