react-email icon indicating copy to clipboard operation
react-email copied to clipboard

Import aliases broken

Open l0gicgate opened this issue 1 year ago • 4 comments

Describe the Bug

After updating from 4.2.12 to 4.3.1 I am getting the following errors now and the dev server crashes.

Downgrading to 4.2.12 fixes the issue.

Could not find file at /home/<redacted>/Documents/github/<redacted>/src/utils/react-email.utils
[Error: ENOENT: no such file or directory, open '/home/<redacted>/Documents/github/<redacted>/src/utils/react-email.utils'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/home/<redacted>/Documents/github/<redacted>/src/utils/react-email.utils'
}

Example imports:

import type { PropsWithChildren } from 'react';

import { Body, Container, Head, Html, Img } from '@react-email/components';

import { imageUrl } from '@/utils/react-email.utils';

Which package is affected (leave empty if unsure)

react-email

Link to the code that reproduces this issue

https://github.com/resend/react-email

To Reproduce

Use aliased imports in a react/typescript project.

Expected Behavior

It should work like it did in 4.2.12

What's your node version? (if relevant)

24.3.0

l0gicgate avatar Oct 21 '25 00:10 l0gicgate

Hello, I would like to work on this bug. Can you assign the issue over to me?

kazekunal avatar Oct 21 '25 19:10 kazekunal

@kazekunal, I do not have permissions to assign issues.

l0gicgate avatar Oct 21 '25 19:10 l0gicgate

I believe this is the culprit: https://github.com/resend/react-email/commit/1e13d1571760fbd2932cca2ab63e3a74292cfcd6#diff-f31d2a6b7a598d2db124529b4ae5bd9ea79389ca069dcda70fec7945030ba96aR149-R153

Using existsSync does not work with import aliases.

l0gicgate avatar Oct 21 '25 19:10 l0gicgate

Seems like this has been fixed as of the latest version from what I could reproduce. Since the issue doesn't have a reproduction, I'm going to close this. If anyone still experiences, share a reproduction and let me know so I can reopen.

gabrielmfern avatar Jan 16 '26 18:01 gabrielmfern