I have a ts module. I'm compiling this module to another project's specific folder by using "outDir" of tsconfig.json and the command "tsc -w". So, every time when I update the ts module it compiles files to the other project but forgetting file extensions while importing. And that means I have to manually update all extensions each time because it is a must in ES6.
I searched if there's a way to compile ts files with file extensions but found nothing. And I searched to disable file extension (".js") need for import/export in an ES6 project. Then I found this:
...configure your server to ignore the extension...
But he is not saying how to configure.
Edit:
I am running my project with nodemon src/index.js
and when a js file generated which has an import without extension this is the error nodemon gave:
[nodemon] restarting due to changes...
[nodemon] starting `node src/index.js`
internal/process/esm_loader.js:74
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\Users\......\trendyol' imported from C:\Users\.......\index.js
at finalizeResolution (internal/modules/esm/resolve.js:276:11)
at moduleResolve (internal/modules/esm/resolve.js:699:10)
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:810:11)
at Loader.resolve (internal/modules/esm/loader.js:86:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:230:28)
at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:56:40)
at link (internal/modules/esm/module_job.js:55:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
[nodemon] app crashed - waiting for file changes before starting...
But when I add extensions ("js"), it works as expected.