-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Open
Labels
Description
🐛 Bug Report
import t from './file';
import d from './directory/'These should both fail to resolve, but since we use the same resolver as for CJS, it doesn't, and the import will work while it would have failed at runtime. This is also the case for dynamic imports.
This might need some support in resolve whenever they add support for ESM? browserify/resolve#222
Place where we call resolve in jest: https://github.com/facebook/jest/blob/c024dec130d9914dcc3418ea74c26f667db3dbfa/packages/jest-runtime/src/index.ts#L395-L398
https://github.com/facebook/jest/blob/c024dec130d9914dcc3418ea74c26f667db3dbfa/packages/jest-runtime/src/index.ts#L423
Node docs: https://nodejs.org/api/esm.html#esm_mandatory_file_extensions
Node issue for better errors: nodejs/node#30603
armfazh, mikicho, alexn-s and GabrielDelepinealexn-s