Skip to content

Conversation

@nmn
Copy link
Collaborator

@nmn nmn commented Nov 21, 2025

What changed / motivation ?

The unplugin package today has two known issues:

  1. The documentation in the Readme is incorrect and misleading
  2. It doesn't handle stylex within external packages correctly in a vite project.

This PR attempts to fix both those issues.

For external packages, the plugin will attempt to detect them automatically, but it also lets you pass in a config option as an escape hatch

Next Steps

  1. The documentation should be a lot better, but it needs to be verified and rewritten for clarity.
  2. Additional testing for building packages that use packages that use StyleX.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 21, 2025
@github-actions
Copy link

workflow: benchmarks/perf

Comparison of performance test results, measured in operations per second. Larger is better.

[email protected] compare
node ./compare.js /tmp/tmp.HlTywevXTB /tmp/tmp.2EYdDuIQ3U

Results Base Patch Ratio
babel-plugin: stylex.create
· basic create 598 624 1.04 +
· complex create 68 67 0.99 -
babel-plugin: stylex.createTheme
· basic themes 451 455 1.01 +
· complex themes 43 42 0.98 -

@github-actions
Copy link

workflow: benchmarks/size

Comparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.

[email protected] compare
node ./compare.js /tmp/tmp.lA263jI2EX /tmp/tmp.V2AVGK9o21

Results Base Patch Ratio
@stylexjs/stylex/lib/cjs/stylex.js
· compressed 1,311 1,311 1.00
· minified 4,150 4,150 1.00
@stylexjs/stylex/lib/cjs/inject.js
· compressed 1,223 1,223 1.00
· minified 3,216 3,216 1.00
benchmarks/size/.build/bundle.js
· compressed 496,650 496,650 1.00
· minified 4,847,840 4,847,840 1.00
benchmarks/size/.build/stylex.css
· compressed 99,853 99,853 1.00
· minified 747,541 747,541 1.00

@mellyeliu mellyeliu changed the title [fix] Add support for compiling stylex from imported packages [unplugin] Add support for compiling stylex from imported packages Nov 21, 2025
Copy link

@sfc-gh-alisowski sfc-gh-alisowski left a comment

Choose a reason for hiding this comment

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

Looks great!

@nmn nmn force-pushed the fix/unplugin-external-deps branch from ebe6874 to ef1d79c Compare November 25, 2025 10:26
@nmn nmn merged commit 9a2a637 into main Nov 25, 2025
1 of 2 checks passed
@nmn nmn deleted the fix/unplugin-external-deps branch November 25, 2025 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants