Auto import in module type projects
When the type: module
is set in the package.json the auto import adds index.js
to the import despite Use directory import […]
is enabled for both javascript as typescript.
When the type is not defined in the package.json it works like a charm.
Please sign in to leave a comment.
This is the expected behavior in ESM projects (with
“type”: “module”
). Please refer to https://nodejs.org/api/esm.html#mandatory-file-extensions. "A file extension must be provided when using the import keyword to resolve relative or absolute specifiers. Directory indexes (e.g. './startup/index.js') must also be fully specified.".