privatenumber / tsx

⚡️ TypeScript Execute | The easiest way to run TypeScript in Node.js
https://tsx.is
MIT License
8.61k stars 132 forks source link

ERR_MODULE_NOT_FOUND when importing without .js since v4.14.0 #585

Closed lukaswiklund closed 3 weeks ago

lukaswiklund commented 3 weeks ago

Acknowledgements

Minimal reproduction URL

https://stackblitz.com/edit/node-arpgm8

Problem & expected behavior (under 200 words)

Since v1.14.0 when using the TS config option "allowImportingTsExtensions: true" I cannot import the UTC extension of Dayjs without using the .js extension. This works when downgrading to v4.13. The Stackbliz editor gives an error either way but that's not relevant here.

Bugs are expected to be fixed by those affected by it

Compensating engineering work financially will speed up resolution

matt-blanchette commented 3 weeks ago

Seeing the same with import 'source-map-support/register'; Returning the same error starting in 4.14.0:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../node_modules/source-map-support/register' imported from __.ts
Did you mean to import "source-map-support/register.js"?
U-4-E-A commented 3 weeks ago

Same issue with importing .ts files from a package in my repo. Not working in v4.15.1, working when reverted back to v4.13.2. mypackage\src\MyFile below is mypackage\src\MyFile.ts: -

node:internal/process/esm_loader:34
      internalBinding('errors').triggerUncaughtException(
                                ^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '<redacted>@repo\mypackage\src\MyFile' imported from '<redacted>\packages\public\src\server.ts
privatenumber commented 3 weeks ago

:tada: This issue has been resolved in v4.15.2

If you rely on this project, please consider making a donation :heart: :pray: