Skip to content

Conversation

gabrielmfern
Copy link
Member

@gabrielmfern gabrielmfern commented Oct 17, 2025

2025-10-17.11-28-44.mp4

This changes things up so that users don't have to install @react-email/preview-server in their projects anymore. It still keeps the @react-email/preview-server published package for backward compatibility, for versioning, and to simplify the changes in this pull request.

This is mainly made so that we can possibly unify everything into react-email, so that users can install just one package for everything related to React Email.

Most of the code stays the same, since the CLI is still importing next from @react-email/preview-server, but now we automatically run npm pack @react-email/preview-server and extract it into $HOME/.react-email. There we also only install next instead of all dependencies, to keep it fast and lightweight.
At the same time, keeping the original source package.json as package.source.json so that we can reuse it during email build.

Everything still works out of the box, this is backwards compatible, and users don't have to do anything special.

There are two downsides to the implementation of this pull request. First, and is that if users regularly switch between React Email versions, it will redownload the preview server each time. Secondly, it's that the local version is not going to be used when running the local CLI, instead it will download the one that's on npm. Both of these we can improve in later versions without breaking changes.


Summary by cubic

Run the React Email UI without adding @react-email/preview-server to your project. The CLI auto-installs the UI into $HOME/.react-email and only installs Next.js, keeping setup fast and backward compatible.

  • New Features
    • Automatically downloads and extracts @react-email/preview-server via npm pack to $HOME/.react-email; installs only next.
    • Ensures the UI version matches react-email; reinstalls on mismatch.
    • Updates email build to use the installed UI and rename package.source.json → package.json; shows an error if the emails directory is missing.
    • Adds install spinners and messages; adds tar dependency and a basic installer test.

Copy link

changeset-bot bot commented Oct 17, 2025

⚠️ No Changeset found

Latest commit: 5871d86

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Oct 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
react-email Ready Ready Preview Comment Oct 20, 2025 3:14pm
react-email-demo Error Error Oct 20, 2025 3:14pm

💡 Enable Vercel Agent with $100 free credit for automated AI reviews

Copy link

socket-security bot commented Oct 17, 2025

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report

@gabrielmfern
Copy link
Member Author

@SocketSecurity ignore npm/next@15.5.6
@SocketSecurity ignore npm/sharp@0.34.4

Copy link

pkg-pr-new bot commented Oct 17, 2025

Open in StackBlitz

npm i https://pkg.pr.new/resend/react-email@2573

commit: 5871d86

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

3 issues found across 8 files

Prompt for AI agents (all 3 issues)

Understand the root cause of the following 3 issues and fix them.


<file name="packages/react-email/src/utils/get-preview-server-location.ts">

<violation number="1" location="packages/react-email/src/utils/get-preview-server-location.ts:42">
Avoid emitting the success spinner message when installation fails; the finally block currently overrides error cases with a success status.</violation>

<violation number="2" location="packages/react-email/src/utils/get-preview-server-location.ts:78">
The installation logic incorrectly assumes `@react-email/preview-server` only needs `next` as a dependency. By stripping out all other dependencies from `package.json`, it guarantees runtime crashes. The original `packages/preview-server/package.json` lists numerous required dependencies that are now omitted from installation.</violation>

<violation number="3" location="packages/react-email/src/utils/get-preview-server-location.ts:87">
The installation process is opaque and harms developer experience. It uses `execSync` with `stdio: &#39;ignore&#39;`, which hides `npm` errors from the user. Furthermore, it breaks the monorepo&#39;s local development workflow by always fetching from npm, which prevents testing local changes to the preview server.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

@gabrielmfern gabrielmfern force-pushed the canary branch 2 times, most recently from 8128be7 to 19de23f Compare October 17, 2025 20:28
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