When I am working with ts-node-dev, imported files must be named like "./api" or "./api.ts" and when the project is built (using tsc), I need "./api.js" (which is normal... it becomes pure js).
Is there a way to make ts understand that .js imports mean .ts in dev and avoid manual rename after build ?
Error type when named "api.js" :
[INFO] 20:24:15 ts-node-dev ver. 1.1.8 (using ts-node ver. 9.1.1, typescript ver. 4.4.3)
Error: Cannot find module './api/api.js'
And the counterpart if named "api" :
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\xxx\dist\api\api' imported from C:\xxx\dist\main.js
Thanks, C
Found solution here : Node can't find modules without .js extension
Simply run :