-
Notifications
You must be signed in to change notification settings - Fork 6
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
transform styled dom component usage for improved performance #154
base: main
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #154 will not alter performanceComparing Summary
|
# Conflicts: # packages/next-yak/runtime/styled.tsx
🦋 Changeset detectedLatest commit: b613991 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
…import only stays if it's needed
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 example app fails because of styled.input.attrs
(which should probably be compiled to __yak_input.attrs
)
# Conflicts: # packages/yak-swc/yak_swc/src/lib.rs
packages/yak-swc/yak_swc/tests/fixture/dynamic-prop-error/output.stderr
Outdated
Show resolved
Hide resolved
packages/yak-swc/yak_swc/tests/fixture/nested-dynamic-mixin/output.stderr
Outdated
Show resolved
Hide resolved
# Conflicts: # packages/next-yak/runtime/__tests__/attrs.test.tsx # packages/next-yak/runtime/styled.tsx
When looking at the minified next-yak usages I had an idea for a smaller bundle size
Initially, we transformed the imports from:
to:
This worked well - but unfortunately we noticed that Webpack was wrapping our function calls with
(0, __yakButton)
to ensure properthis
binding..After we learned that additional transform we went a step further - Instead of individual imports, we now use:
This eliminates the need for webpack's
this
binding wrapper and once minified results in output likea.b("button")
Example App Build Size
before (main + next15 + react19)
after