-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Description
Is your feature request related to a problem? Please describe.
I generate code, which I want to use in a project where I use ECMAScript modules instead of CommonJS (https://nodejs.org/api/esm.html#enabling). A problem here is, that a project using ECMAScript modules requires every import to point to the exact location of the file to import, in which case the path must include the extension of the file name (https://nodejs.org/api/esm.html#mandatory-file-extensions).
This lead me to a stackoverflow question (https://stackoverflow.com/questions/62619058/appending-js-extension-on-relative-import-statements-during-typescript-compilat) where the way to solve it was described as adding the extension to the path.
Describe the solution you'd like
Adjust all import-paths to point to the exact location, so a project, having set moduleResolution to node16 in the compiler options of the tsconfig.json file can compile.
Describe alternatives you've considered
Currently I have to switch back to using CommonJS for my library instead of ECMAScript modules, which would be the preferred option.
Additional context
The ECMAScript section is not all too new (stable since node v14), but I'd still consider this a feature and not a bug, as it is an additional option of generating valid typescript code.