3 ms·
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 wi
by apatheticonion 2y ago
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
- pas 2y agoThere's a "dedicated thread" on the question here https://github.com/nodejs/loaders/issues/214 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 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-2230113189 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.md#type-stripping https://github.com/nodejs/node/blob/main/doc/api/typescript.... ("Node.js will not convert from one module system to another")