[BUG] Regression in 1.27 for ESM file extensions
See original GitHub issueContext:
- Playwright Version: 1.27.1
- Operating System: macOS
- Node.js version: 18.10
- Browser: N/A
- Extra: N/A
Code Snippet
Trying to import test-utils.ts in a Playwright test:
// App.test.ts
import { setupTest } from './test-utils.js';
// Error: Cannot find module './test-utils.js'
Describe the bug
When trying to import .ts files, ESM requires an extension. This was working in version 1.26. However, when upgrading to 1.27, the “Cannot find module” error occurs. Downgrading back to 1.26 again fixes the problem and the file is imported just fine.
Worth highlighting that test-utils.ts (TypeScript) is the extension, not .js, but following convention .js is preferred.
Also worth noting that my repo is not "type": "module" which may be causing an issue (but we are using ESM throughout and are using "module": "ESNext" in TSConfig).
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
rollup changelog
The file structure of Rollup's ESM builds has changed: The main ESM entry point is now at rollup/dist/es/rollup.js instead of rollup/dist/rollup ...
Read more >griebnitz/node_modules/rollup/CHANGELOG.md - GitLab
The file structure of Rollup's ESM builds has changed: The main ESM entry point is now at rollup/dist/es/rollup.js instead of rollup/dist/rollup.
Read more >BusyBox
Bug fix release. 1.27.2 has fixes for svc (work correctly with more than one option specified), unzip (big-endian fix), shuf (was always ...
Read more >What is Regression Testing? Definition, Tools, Method, and ...
Regression testing is a type of testing that is done to verify that a code change in the software does not impact the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Awesome, thanks, I can repro it. I just could not add 2 + 2 in your original description - now that I read it, it explains the use case very well.
does not work in Playwright v1.27 in non-ESM mode.
Sure! I was able to create a fairly-simple repro: https://github.com/drwpow/playwright-import-repro/.
Curious if this is just something weird on my machine or if you see the error too here.