shellscape / jsx-email

Build emails with a delightful DX
https://jsx.email
MIT License
961 stars 31 forks source link

can currently not be used in `tsx` scripts: `does not provide an export named ..` #24

Closed boredland closed 11 months ago

boredland commented 11 months ago

Expected Behavior

Being able to import the render function.

I am using the latest version of @jsx-email/render.

Actual Behavior

import { render } from "@jsx-email/render";
--
09:04:15.584 | ^
09:04:15.584 |  
09:04:15.584 | SyntaxError: The requested module '@jsx-email/render' does not provide an export named 'render'
shellscape commented 11 months ago

I'm afraid you're going to have to provide more information. We're using the import exactly like that in a few places including https://github.com/shellscape/jsx-email/blob/9a4f4c9eda84d1cf113929f2bf1ba3f79c8af6ff/packages/cli/src/commands/build.ts#L6

Side note: Please don't disregard the issue templates, especially:

🚨 Your issue will be CLOSED if:

  • This template is removed
  • Parts of this template are removed

We've got those bits in there specifically so we know more about your environment and don't have to ask for additional info. It's all there to help get issues resolved for you faster.

boredland commented 11 months ago

I initially failed in creating an isolated reproduction, but that helped me discovering, that the actual problem was only when running a script with tsx. That script transitively imports the email template. It seems to be a known issue, but sadly I don't fully understand what is going on and what could be done on the jsx-email side to help: https://github.com/esbuild-kit/tsx/issues/245

shellscape commented 11 months ago

Cool let's keep this open for tracking. I suspect it's on their end at the moment.

boredland commented 11 months ago

Cool let's keep this open for tracking. I suspect it's on their end at the moment.

Me too. For reading this due to similar issues: for me using bunx instead of tsx is a viable alternative without the hurdles.

boredland commented 11 months ago

Seems amending the initial issue was not appreciated, so I created a new one: https://github.com/esbuild-kit/tsx/issues/331

boredland commented 11 months ago

I currently can't reproduce this outside of my main codebase. Will re-open as soon as I can...