fix(react-email): Missing TextDecoder, TextEncoder and stream variants of these on the global
for email components being rendered
#1259
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this fix?
This adds a few things that our
render
utility requires on theglobal
scopeto be ran properly. Missing stuff like
TextDecoder
was causing someone that used itinside their email to have issues on this.
Closes #1258
How can I make sure its fixed?
Copy the code for this
git diff
which has the changes necessary to testCreate a new
temp.patch
and paste the contents of the diffRun
pnpm install
andpnpm build
at the root of the projectRun
npx tsx ../../packages/react-email/src/cli/index.ts
on./apps/demo
Open http://localhost:3000/preview/airbnb-review.tsx
Verify that there are no errors similar to what TextDecoder is not defined when running
email dev
#1258 points outThe patch I show above does the following things for clarification:
render()
function on the usual content for the emaildiv
with its innerHTML set to be the result ofrender()
render()
on@react-email/render
to avoid errors when running the preview server locally