Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I wonder how this handles import resolution.

type: module requires file extensions and does not support importing folders like most people are used to so it will not be compatible with most existing Typescript code.

Will it transform esm import syntax into require statements?

I'd prefer it break existing code to enforce correctness



There's a "dedicated thread" on the question here https://github.com/nodejs/loaders/issues/214

There are about 100 messages in the comments on the linked PR all about the import extensions compatibility/consequences :)

There's a "roadmap doc" here https://github.com/nodejs/loaders/issues/217 that states "No .js extension for .ts files."

> I'd prefer it break existing code to enforce correctness

That seems to be the goal and intent (from TS and Node team too https://github.com/nodejs/node/pull/53725#issuecomment-22301... )

> Will it transform esm import syntax into require statements?

IIUC no

see the docs about which module system Node picks for the loaded files https://github.com/nodejs/node/blob/main/doc/api/typescript.... ("Node.js will not convert from one module system to another")




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: