-
Notifications
You must be signed in to change notification settings - Fork 300
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
Perf: Remove runtime injection from runtime #163
Conversation
compressed-size: runtime library Size change: -0.07 kB
View unchanged
|
compressed-size: e2e bundles Size change: 0.00 kB View unchanged
|
We should probably be checking the size of the bundled runtime in the CI task. It hasn't been showing the contribution of inject or styleq, so the size savings aren't showing up in the results |
I am looking into that. The numbers above are by using |
oh actually it looks like styleq is inlined in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The webpack snapshot issue is because externals
doesn't work on generated code, only source code. I looked into a bunch of potential alternatives, but nothing seems to work or doesn't support ESM syntax. Just a shortcoming of webpack
This is in the ballpark of the size I got in local testing, but the comparison is still wrong since this PR cut the size in half. Will figure this out later. |
It's just because we don't inline |
What changed / motivation ?
The
inject
function has been removed from the main export of@stylex/stylex
. Now the inject function can only be used by manually importing@stylex/stylex/lib/stylex-inject
.The Babel plugin has similarly been updated to import the
inject
function from the new location whenruntimeInjection
is turned on.Also,
runtimeInjection
now accepts a string or{from: string, as: string}
object to be able to override theinject
function module location.Additional Context
Tests have been updated to reflect the changes. The updated snapshots will show what has changed.
NOTE: The Webpack plugin is currently inlining the
stylex-inject
module in the generated code in the snapshot test. Trying to configure Webpack to not do that is causing strange errors.Pre-flight checklist