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
misc updates #3239
misc updates #3239
Conversation
this helps prevent conflicts when multiple versions of the library are in use simultaneously
5392274
to
f3bef57
Compare
@@ -123,7 +131,8 @@ const browserConfig = { | |||
plugins: configBase.plugins.concat( | |||
replace({ | |||
__SERVER__: JSON.stringify(false), | |||
}) | |||
}), | |||
minifierPlugin |
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.
If we're minifying all output bundles (which I'm a fan of) I'd love to make sure to also try out Closure Compiler, which is pretty amazing
styled-components/packages/styled-components/rollup.config.js
Lines 111 to 137 in d220a20
const serverConfig = { | |
...configBase, | |
output: [ | |
getESM({ file: 'dist/styled-components.esm.js' }), | |
getCJS({ file: 'dist/styled-components.cjs.js' }), | |
], | |
plugins: configBase.plugins.concat( | |
replace({ | |
__SERVER__: JSON.stringify(true), | |
}), | |
minifierPlugin | |
), | |
}; | |
const browserConfig = { | |
...configBase, | |
output: [ | |
getESM({ file: 'dist/styled-components.browser.esm.js' }), | |
getCJS({ file: 'dist/styled-components.browser.cjs.js' }), | |
], | |
plugins: configBase.plugins.concat( | |
replace({ | |
__SERVER__: JSON.stringify(false), | |
}), | |
minifierPlugin | |
), | |
}; |
This is what we're currently doing for urql
at least, where we try to squeeze out a lot of bytes here and there https://github.com/FormidableLabs/urql/blob/e031f9b887960a8113890777e8a100973068a36c/scripts/rollup/plugins.js#L98-L137
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.
Shaved off 0.4kB!
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.
So although it reduced the bundle size, something that terser is doing actually regressed perf here. Going to hold off on it for now.
massive perf gain for this use case (5ms chopped off per cycle on average)
not sure how to fix this at the moment since SM runs render twice without providing the backing hook data to the second pass, effectively we have no idea if it's a second instance or not
b8527e1
to
b1f2632
Compare
pay attention to SC_VERSION when hashing to provide more effective component isolation when multiple SC instances are running on the page
Bundle size improvements
Fix
keyframes
not receiving nested stylis context, and therefore missing plugins if applicableFixes #3008 #3076 #2993 #3163
Probably fixes #2074