Skip to content

fix: add esbuild bundling guard and tests to prevent react-email regression#225

Merged
felipefreitag merged 2 commits intomainfrom
fix/esbuild-bundling-guard-b754
Apr 16, 2026
Merged

fix: add esbuild bundling guard and tests to prevent react-email regression#225
felipefreitag merged 2 commits intomainfrom
fix/esbuild-bundling-guard-b754

Conversation

@bukinoshita
Copy link
Copy Markdown
Member

@bukinoshita bukinoshita commented Apr 9, 2026

Summary by cubic

Adds prepack bundle guards and tests to ensure esbuild stays external and is never inlined. Follow-up to BU-610 to prevent React email bundling regressions.

  • Bug Fixes
    • Prepack checks in scripts/verify-bundle.mjs: fail if the inlined esbuild marker is found or if require("esbuild") is missing from dist/cli.cjs.
    • Tests for bundleReactEmail and the verify script: verify build options, tmp cleanup on failure, and all validation paths (PostHog key, inlined marker, missing external require, happy path).

Written for commit 203ab0a. Summary will update on new commits.

@bukinoshita
Copy link
Copy Markdown
Member Author

@cubic-dev-ai can you review?

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented Apr 13, 2026

@cubic-dev-ai can you review?

@bukinoshita I have started the AI code review. It will take a few minutes to complete.

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.

No issues found across 3 files

@bukinoshita bukinoshita marked this pull request as ready for review April 13, 2026 22:03
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.

No issues found across 3 files

@felipefreitag felipefreitag force-pushed the fix/esbuild-bundling-guard-b754 branch from 64d43c7 to 3884e71 Compare April 16, 2026 17:31
cursoragent and others added 2 commits April 16, 2026 14:37
…ession

- Add two checks to verify-bundle.mjs: detect inlined esbuild guard
  string and verify external require('esbuild') is present in bundle
- Add unit tests for bundleReactEmail (mocking esbuild at boundary)
- Add tests for verify-bundle script covering all validation paths

Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
- verify-bundle.mjs accepts optional CLI path arg so tests don't
  overwrite dist/cli.cjs; adds esbuild-wasm external require check
- Extract loadEsbuild to its own module for testability
- Verify-bundle tests use temp files instead of mutating dist/
- React-email-bundler test actually asserts tmpDir cleanup on failure
@felipefreitag felipefreitag force-pushed the fix/esbuild-bundling-guard-b754 branch from 3884e71 to ff175c8 Compare April 16, 2026 17:37
@felipefreitag felipefreitag merged commit 511d866 into main Apr 16, 2026
9 checks passed
@felipefreitag felipefreitag deleted the fix/esbuild-bundling-guard-b754 branch April 16, 2026 17:50
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.

3 participants