Skip to content

Comments

fix(preview-server): requiring peers to also have matching esbuild versions#2971

Draft
gabrielmfern wants to merge 3 commits intocanaryfrom
feature/oss-400-mismatching-esbuild-versions-breaks-the-preview-server
Draft

fix(preview-server): requiring peers to also have matching esbuild versions#2971
gabrielmfern wants to merge 3 commits intocanaryfrom
feature/oss-400-mismatching-esbuild-versions-breaks-the-preview-server

Conversation

@gabrielmfern
Copy link
Member

@gabrielmfern gabrielmfern commented Feb 20, 2026

Summary by cubic

Auto-set ESBUILD_BINARY_PATH to the platform-specific esbuild binary resolved alongside the used esbuild JS to prevent crashes from version mismatches in monorepos. Applies only when safe, so projects don’t need to pin esbuild to the server’s version.

  • Bug Fixes
    • Resolve the platform package @esbuild/- and point ESBUILD_BINARY_PATH to its real binary (bin/esbuild or esbuild.exe).
    • Only runs when ESBUILD_BINARY_PATH is unset, allowing manual overrides.
    • Addresses OSS-400 (mismatching esbuild versions break the preview server).

Written for commit 0f5843b. Summary will update on new commits.

@gabrielmfern gabrielmfern self-assigned this Feb 20, 2026
@changeset-bot
Copy link

changeset-bot bot commented Feb 20, 2026

⚠️ No Changeset found

Latest commit: 0f5843b

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

@vercel
Copy link

vercel bot commented Feb 20, 2026

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

Project Deployment Actions Updated (UTC)
react-email Ready Ready Preview, Comment Feb 23, 2026 0:20am
react-email-demo Ready Ready Preview, Comment Feb 23, 2026 0:20am

Request Review

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 20, 2026

Open in StackBlitz

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

commit: 0f5843b

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.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


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

<violation number="1" location="packages/react-email/src/utils/preview/start-dev-server.ts:146">
P2: `esmResolve()` returns the module entry path (like `.../bin/esbuild`), so joining `subpath` again produces a non-existent path and prevents `ESBUILD_BINARY_PATH` from being set. Use the entry file’s directory before appending `subpath` so the binary can be found and the OSS-400 fix works.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment on lines +146 to +148
const candidateBinaryPath = path.join(
await fs.realpath(esbuild.esmResolve(platformPackage)),
subpath,
Copy link
Contributor

Choose a reason for hiding this comment

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

P2: esmResolve() returns the module entry path (like .../bin/esbuild), so joining subpath again produces a non-existent path and prevents ESBUILD_BINARY_PATH from being set. Use the entry file’s directory before appending subpath so the binary can be found and the OSS-400 fix works.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/react-email/src/utils/preview/start-dev-server.ts, line 146:

<comment>`esmResolve()` returns the module entry path (like `.../bin/esbuild`), so joining `subpath` again produces a non-existent path and prevents `ESBUILD_BINARY_PATH` from being set. Use the entry file’s directory before appending `subpath` so the binary can be found and the OSS-400 fix works.</comment>

<file context>
@@ -139,34 +139,21 @@ export const startDevServer = async (
-        nodeModulesDir,
-        platformPkg,
-        'package.json',
+      const candidateBinaryPath = path.join(
+        await fs.realpath(esbuild.esmResolve(platformPackage)),
+        subpath,
</file context>
Suggested change
const candidateBinaryPath = path.join(
await fs.realpath(esbuild.esmResolve(platformPackage)),
subpath,
const candidateBinaryPath = path.join(
path.dirname(await fs.realpath(esbuild.esmResolve(platformPackage))),
subpath,
);

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.

1 participant