Skip to content

feat: support --react-email flag in binaries#271

Merged
felipefreitag merged 4 commits intomainfrom
worktree-esbuild-wasm-experiment
Apr 16, 2026
Merged

feat: support --react-email flag in binaries#271
felipefreitag merged 4 commits intomainfrom
worktree-esbuild-wasm-experiment

Conversation

@felipefreitag
Copy link
Copy Markdown
Contributor

@felipefreitag felipefreitag commented Apr 15, 2026

Summary by cubic

Enable React Email templates in compiled binaries by loading esbuild-wasm when running under pkg, while keeping native esbuild for npm installs. Adds cross-platform CI to prove bundling/rendering across macOS, Linux, and Windows binaries.

  • New Features

    • --react-email works in Homebrew/curl/Windows installer binaries via esbuild-wasm fallback.
    • Automatically detects pkg runtime and loads esbuild-wasm; uses esbuild otherwise.
    • CI builds binaries and tests a React Email template; treats "send_error" or "auth_error" as success to confirm bundling/rendering reached the API call.
    • Updated CLI help text to remove “(npm install only)”.
  • Dependencies

    • Added esbuild-wasm@0.28.0 and configured pkg to include its scripts/assets.
    • Updated build script to externalize esbuild and esbuild-wasm.
    • Passed --config package.json to all pkg invocations in workflows and build:bin so assets are bundled.

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

if ('pkg' in process) {
return require('esbuild-wasm');
}
return require('esbuild');
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Native esbuild works and is faster in the npm-installed version

@felipefreitag felipefreitag marked this pull request as ready for review April 15, 2026 19:44
@felipefreitag felipefreitag changed the title feat: esbuild wasm experiment feat: support --react-email flag in binaries Apr 15, 2026
Copy link
Copy Markdown
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 15 files

Prompt for AI agents (unresolved 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=".github/workflows/test-react-email-binary.yml">

<violation number="1" location=".github/workflows/test-react-email-binary.yml:49">
P1: `|| true` masks command failures, so this CI test can pass even when the binary invocation itself is broken.</violation>
</file>

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

Comment thread .github/workflows/test-react-email-binary.yml
The --react-email flag was blocked for binary users (Homebrew, curl,
Windows installer) because esbuild's native platform-specific binaries
can't be packaged into pkg binaries. This uses esbuild-wasm as a
fallback when running inside a pkg binary, keeping native esbuild
for npm users.

- Add esbuild-wasm dependency as WASM-based fallback for pkg binaries
- Detect pkg runtime and dynamically load esbuild-wasm instead of esbuild
- Configure pkg to include esbuild-wasm scripts and WASM asset
- Add --config package.json to all pkg invocations in CI workflows
- Remove (npm install only) from --react-email flag descriptions
- Add cross-platform CI workflow to test react-email in binaries
Instead of checking that build/render error codes are absent (which
would also pass on segfaults or missing binaries), check that
send_error is present — proving the template was bundled, rendered,
and reached the API call.
On Windows CI there's no credential store, so the CLI fails with
auth_error before reaching the API. Since buildReactEmailHtml runs
before requireClient, auth_error also proves bundling + rendering
succeeded.
@felipefreitag felipefreitag force-pushed the worktree-esbuild-wasm-experiment branch from c532539 to f1fe94d Compare April 16, 2026 16:13
@felipefreitag felipefreitag merged commit 1df0600 into main Apr 16, 2026
10 checks passed
@felipefreitag felipefreitag deleted the worktree-esbuild-wasm-experiment branch April 16, 2026 16:17
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