shellscape / jsx-email

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

Cannot build template after creating it #92

Closed aidan-rypens closed 10 months ago

aidan-rypens commented 10 months ago

To reproduce:

  1. Run npx email create BatmanEmail
  2. Run npx email build ./BatmanEmail.tsx

Error: image

Rendering the component out & emailing runs fine. However, because the layout received in the mailbox does not match the one from the preview and therefore wanted to debug a bit.

image

shellscape commented 10 months ago

Would love to help you out, but please first follow the instructions and create a reproduction using one of the options listed in the issue template.

aidan-rypens commented 10 months ago

Sure, I ran the following: npm create jsx-email.

This starter project doesn't build nor can it run the check.

shellscape commented 10 months ago

Not trying to be difficult here, we just ask everyone (even maintainers) to follow the same instructions. The template has the following content right before inputs:

🚨 Issues WITHOUT a valid reproduction WILL BE CLOSED!

Please provide one by:

  1. Using the StackBlitz reproduction template at https://stackblitz.com/fork/jsx-email-repro
  2. Provide a minimal repository link (Read https://gist.github.com/Rich-Harris/88c5fc2ac6dc941b22e7996af05d70ff for instructions). Please use NPM for installing dependencies! These may take more time to triage than the other options.

    ⚠️ ZIP Files are unsafe and maintainers will NOT download them.

I worked on the create-jsx-email package just a day or so ago and tested it working and just ran it again and it's working fine here. So unless you can provide an actual repro with code I can look at, like a stackblitz with the output of the command on your end, there's really nothing I can do for you to help

shellscape commented 10 months ago

Tweaked the exports inspection logic in any event. Maybe jsx-email@1.1.2 will work for your case.

aidan-rypens commented 10 months ago

@shellscape I understand, here is the stackblitz url:

https://stackblitz.com/edit/jsx-email-repro-wjaq7f?file=templates%2FReproduction.tsx

image

Updating to 1.1.2 gives the error that React is not defined. image

shellscape commented 10 months ago

Here's my fork off of yours: https://stackblitz.com/edit/jsx-email-repro-9j4pkr?file=package.json

I updated to 1.1.2 and ran pnpm i to make sure the newest version was installed, and then ran pnpm build. It successfully built:

Screenshot 2023-12-05 at 12 29 05 PM
shellscape commented 10 months ago

Also for what it was worth, without forking yours, I was able to update jsx-email and run build. This screenshot is from your stackblitz:

Screenshot 2023-12-05 at 12 31 19 PM
aidan-rypens commented 10 months ago

@shellscape By adding import * as React from "react"; it does indeed work. (sorry)

Not sure why it was not added though, because I generated with the CLI as an example. The CLI create command does generate a sample with the import. I may have removed the line by accident, weird.

Thanks for having a look!

shellscape commented 10 months ago

No wories! Glad it worked out