Skip to content

URL is not defined during email rendering in react-email v2 #1229

@matchai

Description

@matchai

Describe the Bug

When trying to use the URL() constructor in an email surfaces the error ReferenceError: URL is not defined in the preview.

CleanShot 2024-01-23 at 18 54 29@2x

Which package is affected (leave empty if unsure)

react-email

Link to the code that reproduces this issue

https://github.com/matchai/react-email-issue-repro/blob/url-issue-repro/emails/url-repro.tsx

To Reproduce

Add new URL("https://example.com") anywhere in your email code.

Expected Behavior

The global URL object functions as it does in other JavaScript environments.

What's your node version? (if relevant)

21.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: react-emailThis is the CLI we generally use as just `email` on the temrinal.Type: BugConfirmed bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions