Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add babel plugin to optimize web output #29

Merged
merged 1 commit into from
Feb 26, 2024
Merged

Conversation

necolas
Copy link
Contributor

@necolas necolas commented Feb 23, 2024

The babel plugin can be used to optimize web builds.

  • Removes the React component wrapper and its associated runtime performance overhead.
  • Reduces the compressed bundle size of the runtime from 2.9 KB to 0.9KB. This brings the combined runtime size of RSD and StyleX on web to about 2 KB.

Fix #23

@necolas necolas added the improvement Technical improvement label Feb 23, 2024
@necolas necolas requested a review from nmn February 23, 2024 01:38
Copy link

github-actions bot commented Feb 23, 2024

compressed-size: runtime library

Size change: +0.97 kB
Total size: 15.89 kB

Filename: gzip (minify) kB size kB change % change
./packages/react-strict-dom/dist/dom.js 2.89 (8.62) +0.05 (-0.20) +1.9% (-2.2%) 🔴
./packages/react-strict-dom/dist/runtime.js 0.92 (2.26) +0.92 (+2.26) +100.0% (+100.0%) 🔴
View unchanged
Filename: gzip (minify) kB size kB change % change
./packages/react-strict-dom/dist/native.js 12.08 (37.83) 0.00 (0.00) 0.0% (0.0%)

Copy link
Contributor

@nmn nmn left a comment

Choose a reason for hiding this comment

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

Found some nits but they're edge-cases that can be fixed later.


But I wonder if it would better to make this a separate package?

packages/react-strict-dom/babel.js Outdated Show resolved Hide resolved
@necolas necolas force-pushed the improvement-babel-plugin branch 2 times, most recently from 13efe83 to 75e0690 Compare February 26, 2024 21:03
The babel plugin can be used by web builds to inline the component
wrapper and remove the runtime overhead.

Fix #23
@necolas necolas force-pushed the improvement-babel-plugin branch from 75e0690 to 75f19ec Compare February 26, 2024 21:51
@necolas necolas merged commit 95034a0 into main Feb 26, 2024
6 checks passed
@necolas necolas deleted the improvement-babel-plugin branch February 27, 2024 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed improvement Technical improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiler: inline wrapper component on web
4 participants