-
Notifications
You must be signed in to change notification settings - Fork 14
Optimize imports of css
, styled
and utils
#236
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
Comments
I think this is only implemented for imports of |
Yes exactly. The idea was that all functions get the same treatment as @Tyderion did with So the current transpilation of the functions e.g. import { styled, css, __yak_unitPostFix } from "next-yak/internal";
import * as __yak from "next-yak/internal"; would get transpiled to import * as __yak from "next-yak/internal"; and used accordingly. This would help for minification. |
does this really make a difference for minification? |
Maybe. In the ideal world it shouldn't have any implications on bundle size. I thought that less characters in this approach (without explicit this binding) maybe would have an impact, but practically speaking creating a prod minification for our class names would have the way bigger effect. I think this Issue is still valid for the case that we then have only one import for all yak specific utility functions (besides the CSS module import) instead of two, but this is also not very important 😅 What do you think @jantimon? |
Currently transformed inputs for those functions are as follows:
If we optimize and use same trick as used in #154 and import it the following way:
Webpack will better optimize bundle size because it can use (minified, e.g.)
s.As
instead of(0, s.As)
to access those functionsThe text was updated successfully, but these errors were encountered: