Skip to content

Conversation

vlaforet
Copy link
Contributor

@vlaforet vlaforet commented Apr 19, 2024

Background

As we need to pre-import the modules from Node into the app before loading them with vm
we also need to define the context in which the code will run for us to get the email's component,
this means that we need to pass in a few other global things like Buffer that the global
dynamically doesn't contain.

What was the issue?

That being said, something that was missing from the global context was the URLSearchParams class,
which this PR adds. Similar to #1232.

How can I test to make sure it's fixed?

  1. Run npx tsx ../../packages/react-email/src/cli/index.ts dev inside of ./apps/demo
  2. Modify the email at ./apps/demo/emails/airbnb-review.tsx by adding the following:
console.log(new URLSearchParams(""));
  1. Open http://localhost:3000/preview/airbnb-review.tsx
  2. Verify that this errors with "Invalid path" instead of with URLSearchParams is not defined

Copy link

vercel bot commented Apr 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-email-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 19, 2024 5:43pm

Copy link

vercel bot commented Apr 19, 2024

@vlaforet is attempting to deploy a commit to the resend Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Member

@gabrielmfern gabrielmfern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants