Skip to content

fix(react-email): use project root as outputFileTracingRoot in email build#3576

Merged
felipefreitag merged 6 commits into
resend:canaryfrom
yashs33244:fix/build-vercel-tracing-root
Jul 2, 2026
Merged

fix(react-email): use project root as outputFileTracingRoot in email build#3576
felipefreitag merged 6 commits into
resend:canaryfrom
yashs33244:fix/build-vercel-tracing-root

Conversation

@yashs33244

@yashs33244 yashs33244 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

The generated .react-email/next.config.mjs set outputFileTracingRoot and turbopack.root to previewServerLocation (the .react-email subfolder). Next.js file tracing and @vercel/next expect the tracing root to be the project root, so every traced server-function path was off by the .react-email prefix and vercel build failed with ENOENT (e.g. jsx-runtime/jsx-dev-runtime.js). Local email build worked; only vercel build failed.

This points the non-monorepo tracing root at userProjectLocation (the parent of .react-email), mirroring the monorepo layout that already deploys. I pulled the decision into a small pure getTracingRootExpression helper and added unit tests for both branches. The monorepo path is unchanged.

Closes #3557


Summary by cubic

Fixes Vercel deploys of the react-email preview app by tracing from the user's project root in the generated .react-email/next.config.mjs. Non-monorepo builds now use userProjectLocation; monorepo behavior is unchanged.

  • Bug Fixes
    • Set outputFileTracingRoot and turbopack.root to the project root instead of .react-email, preventing ENOENT during vercel build (e.g., jsx-runtime/jsx-dev-runtime.js).

Closes #3557

Written for commit cd0e05b. Summary will update on new commits.

Review in cubic

…build

The generated .react-email/next.config.mjs set outputFileTracingRoot and
turbopack.root to previewServerLocation (the .react-email subfolder). Next.js
file tracing and @vercel/next expect the tracing root to be the project root,
so every traced server-function path was off by the .react-email prefix and
vercel build failed with ENOENT (e.g. jsx-runtime/jsx-dev-runtime.js).

Point the non-monorepo tracing root at userProjectLocation (the parent of
.react-email), mirroring the monorepo layout that already deploys. Extracted
the decision into a pure, unit-tested getTracingRootExpression helper.

Closes resend#3557
Copilot AI review requested due to automatic review settings June 16, 2026 15:50
@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

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

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cd0e05b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
react-email Patch
@react-email/editor Patch
@react-email/ui Patch

Not sure what this means? Click here to learn what changesets are.

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread packages/react-email/src/cli/commands/build.ts

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Alters generated deployment config for Next.js file tracing; fix is targeted but affects vercel build, requiring human review for deployment impact.

Re-trigger cubic

Comment thread packages/react-email/src/cli/commands/utils/get-tracing-root-expression.ts Outdated

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

0 issues found across 4 files (changes from recent commits).

Auto-approved: Fix a Vercel deployment bug by correcting the file tracing root path. Single-line change in build config with low risk and clear rationale.

Re-trigger cubic

@pkg-pr-new

pkg-pr-new Bot commented Jul 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: cd0e05b

@felipefreitag felipefreitag merged commit cb3c468 into resend:canary Jul 2, 2026
12 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linear-synced PR has been synced to Linear

Projects

None yet

4 participants