Skip to content

fix: enable React Compiler for @lifi/widget and @lifi/wallet-management#768

Open
smrnjeet222 wants to merge 1 commit into
lifinance:mainfrom
smrnjeet222:feat/react-compiler
Open

fix: enable React Compiler for @lifi/widget and @lifi/wallet-management#768
smrnjeet222 wants to merge 1 commit into
lifinance:mainfrom
smrnjeet222:feat/react-compiler

Conversation

@smrnjeet222

Copy link
Copy Markdown

Which Linear task is linked to this PR?

N/A - outside contributor

Why was it implemented this way?

Enables the React Compiler (babel-plugin-react-compiler@^1.0.0, target 19) across the widget toolchain. The widget already runs on React 19, this PR turns on the compiler's automatic memoization.

Wiring

  • Library packages (@lifi/widget, @lifi/wallet-management) : added @rolldown/plugin-babel + @babel/core and registered babel-plugin-react-compiler in their tsdown.config.ts so the compiler runs at publish build time. Consumers receive pre-compiled output and don't need to add the plugin themselves.
  • App packages (widget-embedded, widget-playground-vite) : registered the plugin via @vitejs/plugin-react's babel.plugins option so the playground / iframe host benefit too.
  • knip.json : ignore babel-plugin-react-compiler (only referenced as a string by Babel, not imported).

Picked the tsdown + @rolldown/plugin-babel route over swc/oxc because the React Compiler currently ships only as a Babel plugin, running it through Babel during the rolldown build is the supported path and keeps the rest of the pipeline (rolldown/oxc) untouched.

Codebase implications (no refactor in this PR)

  • The compiler auto-memoizes components and hook return values. Going forward, new code should skip manual useMemo / useCallback / React.memo / forwardRef unless there's a measured reason, the compiler handles it.
  • Existing usages are intentionally not refactored in this PR to keep the diff reviewable and bisectable. can clean them up incrementally (or via a dedicated codemod PR) once validated the compiler.
  • forwardRef is also unnecessary on React 19 (ref is a regular prop), same "don't add new ones, clean up later" rule.

Visual showcase (Screenshots or Videos)

N/A - build-time change, no runtime/UI behavior change.

Checklist before requesting a review

  • I have performed a self-review and testing of my code.
  • This pull request is focused and addresses a single problem.
  • If this PR modifies the Widget API or adds new features that require documentation, I have updated the documentation in the public-docs repository.

@changeset-bot

changeset-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c21414c

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

This PR includes changesets to release 5 packages
Name Type
@lifi/widget Minor
@lifi/wallet-management Minor
nft-checkout Patch
tanstack-router-example Patch
vite-iframe 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

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