Open KcZer0 opened 4 months ago
Error code when importing directory in Node.js is ERR_UNSUPPORTED_DIR_IMPORT. But in Yarn PnP+ESM it's ERR_MODULE_NOT_FOUND.
ERR_UNSUPPORTED_DIR_IMPORT
ERR_MODULE_NOT_FOUND
This is causing import error for custom loader as in https://github.com/privatenumber/tsx/issues/439
package.json
{ "type": "module" }
dir/index.js
export {};
index.js
try { const a = await import('./dir'); console.log(a); } catch ({ code }) { console.log(code); // node: `ERR_UNSUPPORTED_DIR_IMPORT` // yarn-pnp-esm: `ERR_MODULE_NOT_FOUND` }
System: OS: Windows 11 10.0.22631 CPU: (16) x64 AMD Ryzen 7 6800H with Radeon Graphics Binaries: Node: 20.11.0 - D:\Temp\AppData\xfs-e4b9d728\node.CMD Yarn: 4.2.2 - D:\Temp\AppData\xfs-e4b9d728\yarn.CMD npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD
No response
Self-service
Describe the bug
Error code when importing directory in Node.js is
ERR_UNSUPPORTED_DIR_IMPORT
. But in Yarn PnP+ESM it'sERR_MODULE_NOT_FOUND
.This is causing import error for custom loader as in https://github.com/privatenumber/tsx/issues/439
To reproduce
package.json
dir/index.js
index.js
Environment
Additional context
No response