Skip to content

chore(react/transform): migrate from esbuild to Rslib#2239

Open
colinaaa wants to merge 4 commits intolynx-family:mainfrom
colinaaa:chore/migrate-esbuild-to-rslib
Open

chore(react/transform): migrate from esbuild to Rslib#2239
colinaaa wants to merge 4 commits intolynx-family:mainfrom
colinaaa:chore/migrate-esbuild-to-rslib

Conversation

@colinaaa
Copy link
Copy Markdown
Collaborator

@colinaaa colinaaa commented Feb 13, 2026

Summary by CodeRabbit

  • Chores
    • Switched WASM build to rslib, removed esbuild from dev dependencies, and updated wasm build inputs.
  • New Features
    • Added a lightweight loader for importing WASM bytes.
  • Tests
    • Simplified tests to assert normalized warning/error objects instead of formatted esbuild messages.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

@colinaaa colinaaa requested a review from gaoachao as a code owner February 13, 2026 07:52
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 13, 2026

⚠️ No Changeset found

Latest commit: df45887

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 13, 2026

📝 Walkthrough

Walkthrough

Replace ad-hoc Node.js WASM build with an rslib/rsbuild configuration, add a buffer loader and rspack aliases, remove esbuild devDependency and legacy build script, adjust wasm import and build inputs, and update tests to assert raw warnings instead of using esbuild formatting.

Changes

Cohort / File(s) Summary
Package manifest
packages/react/transform/package.json
Replaced build:wasm command with rslib build and removed esbuild from devDependencies.
Rsbuild config
packages/react/transform/rslib.config.ts
New rslib/rsbuild config: cargo build plugin for wasm, lib/output settings, wasm entry, rspack aliases/loader and module rule for .wasm.
Loader
packages/react/transform/scripts/buffer-loader.cjs
Added CommonJS loader that returns Buffer.from(base64, "base64") and marks the loader as raw.
Removed legacy script
packages/react/transform/scripts/build_wasm.js
Deleted previous Node.js build script that ran cargo and esbuild and copied wasm artifacts.
Build inputs
packages/react/transform/turbo.json
Updated build:wasm inputs: removed scripts/build_wasm.sh, added rslib.config.ts and scripts/buffer-loader.cjs.
Source import
packages/react/transform/src/wasm.js
Switched WASM import from ../dist/react_transform.wasm to alias #react_transform.wasm.
Tests
packages/react/transform/__test__/*
Removed runtime esbuild formatMessages usage; tests now assert result.warnings/result.errors or normalized warning objects directly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • gaoachao
  • upupming

Poem

🐇 I hopped from scripts into rslib's glen,
Cargo stitched bytes with a rustling pen,
A tiny loader wraps wasm in fur,
Tests now read warnings without the blur,
Carrots for build — let's hop again! 🥕

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (26 files):

⚔️ benchmark/react/package.json (content)
⚔️ examples/motion/package.json (content)
⚔️ examples/react-compiler/package.json (content)
⚔️ examples/react-externals/package.json (content)
⚔️ examples/react-lazy-bundle/package.json (content)
⚔️ examples/react/package.json (content)
⚔️ examples/tailwindcss/package.json (content)
⚔️ package.json (content)
⚔️ packages/lynx/gesture-runtime/package.json (content)
⚔️ packages/motion/package.json (content)
⚔️ packages/react/package.json (content)
⚔️ packages/react/runtime/package.json (content)
⚔️ packages/react/transform/__test__/css/inline-style.spec.js (content)
⚔️ packages/react/transform/__test__/css/object-lit-style.spec.js (content)
⚔️ packages/react/transform/__test__/fixture.spec.js (content)
⚔️ packages/react/transform/package.json (content)
⚔️ packages/react/transform/src/wasm.js (content)
⚔️ packages/react/transform/turbo.json (content)
⚔️ packages/react/worklet-runtime/package.json (content)
⚔️ packages/rspeedy/core/package.json (content)
⚔️ packages/rspeedy/create-rspeedy/template-react-ts/package.json (content)
⚔️ packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/package.json (content)
⚔️ packages/rspeedy/upgrade-rspeedy/package.json (content)
⚔️ packages/testing-library/examples/react-compiler/package.json (content)
⚔️ pnpm-lock.yaml (content)
⚔️ website/package.json (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: migrating the react/transform package from esbuild to Rslib as the build tool.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch chore/migrate-esbuild-to-rslib
  • Post resolved changes as copyable diffs in a comment

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 0% with 85 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/react/transform/rslib.config.ts 0.00% 76 Missing ⚠️
packages/react/transform/scripts/buffer-loader.cjs 0.00% 7 Missing ⚠️
packages/react/transform/src/wasm.js 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/react/transform/src/wasm.js`:
- Around line 7-9: The top-of-file build comment in wasm.js is stale: replace or
remove the line starting with "build with `./node_modules/.bin/esbuild ..." so
it no longer references the old esbuild command; either update it to the current
build instruction that uses "rslib build" or remove the comment entirely to
avoid confusion (the import line "import bytes from '#react_transform.wasm';"
and the file wasm.js are the anchors to locate the change).
🧹 Nitpick comments (2)
packages/react/transform/rslib.config.ts (2)

55-61: The WASM path traverses three directories up to the repo root — verify this holds in all build environments.

path.resolve(root, '../../../target/...') assumes the monorepo's target/ directory is exactly three levels above packages/react/transform. This is correct for the standard layout but could break if the package is ever moved or if cargo's target directory is overridden (e.g., via CARGO_TARGET_DIR).

Consider deriving the repo root dynamically (e.g., from a workspace root marker or git rev-parse --show-toplevel) instead of hard-coding the relative depth, or at minimum add a comment documenting this assumption.


10-27: Optional: Consider adding explicit type annotation for api parameter for consistency and clarity.

The satisfies RsbuildPlugin constraint provides structural type inference for the api parameter, but explicit annotation makes the intent clearer in strictest mode. The codebase shows mixed patterns—some setup methods use explicit RsbuildPluginAPI annotation (e.g., in test files), while others rely on satisfies inference. Adding an explicit type would align with the strictest TypeScript configuration.

💡 Suggested annotation
-  setup(api) {
+  setup(api: Parameters<RsbuildPlugin['setup']>[0]) {

Or use the exported RsbuildPluginAPI type directly if available from @rslib/core.

@relativeci
Copy link
Copy Markdown

relativeci bot commented Feb 13, 2026

Web Explorer

#7674 Bundle Size — 383.74KiB (0%).

df45887(current) vs 87682f6 main#7667(baseline)

Bundle metrics  Change 1 change
                 Current
#7674
     Baseline
#7667
No change  Initial JS 154.88KiB 154.88KiB
No change  Initial CSS 35.06KiB 35.06KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 8 8
Change  Modules 239(+0.84%) 237
No change  Duplicate Modules 16 16
No change  Duplicate Code 2.99% 2.99%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#7674
     Baseline
#7667
No change  JS 252.83KiB 252.83KiB
No change  Other 95.85KiB 95.85KiB
No change  CSS 35.06KiB 35.06KiB

Bundle analysis reportBranch colinaaa:chore/migrate-esbuild-t...Project dashboard


Generated by RelativeCIDocumentationReport issue

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Feb 14, 2026

Merging this PR will degrade performance by 6.07%

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 61 untouched benchmarks
⏩ 3 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
basic-performance-scroll-view-100 11 ms 10.4 ms +5.36%
basic-performance-div-10000 456.6 ms 486.2 ms -6.07%

Comparing colinaaa:chore/migrate-esbuild-to-rslib (df45887) with main (63a1cdb)2

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (87682f6) during the generation of this report, so 63a1cdb was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant