Hello
I'm trying to use this project with react-email, and I compile it with tsc using:
tsc index.ts --target esnext --moduleResolution nodenext --module nodenext --jsx react-jsx
Importing this project like this in index.ts:
import {createMimeMessage, Mailbox, MailboxAddrObject} from "mimetext";
But it complains that file extensions are missing in this configuration:
node_modules/mimetext/dist/MIMEMessageContent.d.ts:1:41 - error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.
1 import type { EnvironmentContext } from './MIMEMessage';
~~~~~~~~~~~~~~~
node_modules/mimetext/dist/MIMEMessageContent.d.ts:2:30 - error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.
2 import type { Mailbox } from './Mailbox';
~~~~~~~~~~~
node_modules/mimetext/dist/MIMEMessageHeader.d.ts:1:41 - error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.
1 import type { EnvironmentContext } from "./MIMEMessage";
~~~~~~~~~~~~~~~
It is fixed by simply adding .d.ts to these types, i.e:
import type { EnvironmentContext } from './MIMEMessage.d.ts';
nodenext is required in order to compile react-email, so I cannot omit this. It seems you can also just add .js, but I'm unsure in which places this would cause a problem. It just needs any of the valid file extensions, it seems.
Hello
I'm trying to use this project with
react-email, and I compile it with tsc using:tsc index.ts --target esnext --moduleResolution nodenext --module nodenext --jsx react-jsxImporting this project like this in
index.ts:But it complains that file extensions are missing in this configuration:
It is fixed by simply adding
.d.tsto these types, i.e:nodenextis required in order to compilereact-email, so I cannot omit this. It seems you can also just add.js, but I'm unsure in which places this would cause a problem. It just needs any of the valid file extensions, it seems.