Last Good Version
1.42
First Bad Version
1.43
Steps to reproduce
Repo + Reproduction steps are in the repository: https://github.com/schickling-test/2024-playwright-esm-repro
Expected behavior
Works
Actual behavior
Error: Directory import '/Users/maxschmitt/Developer/tmp/2024-playwright-esm-repro/packages/@acme/lib' is not supported resolving ES modules imported from /Users/maxschmitt/Developer/tmp/2024-playwright-esm-repro/packages/@acme/tests/src/hello.test.ts
Additional context
We run into this if for the directory import:
|
if (resolved !== undefined) |
and then pass the directory as a file:// URL to the defaultResolver which breaks.
I throws here: https://github.com/nodejs/node/blob/e192a32c27f223e7a3dcb43134fd891dd8ded760/lib/internal/modules/esm/resolve.js#L254
Workaround, add a check like !require('fs').statSync(resolved).isDirectory().
Environment