-
-
Notifications
You must be signed in to change notification settings - Fork 140
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
CSS Prop taking effect when exporting library. #222
Comments
I'd double check the plugin is being added for your production build... if you use something like the "env" setting in your babel config and change the presets or plugins at all you have to recompose all of them. Do you have a reproduction repo? |
Hey there, I created a small reproduction repo of the issue where I simply created & exported a button. You can find the related code here: https://github.com/3nvi/styled-components-css-rollup You can verify that it's not working by visiting the following CodeSandbox project, where the repo is installed & utilized: https://codesandbox.io/s/dank-https-8mee9 In addition, I also found the following 2 threads on Spectrum that unfortunately received no answer: Any help from the SC team is greatly appreciated. Thanks in advance for your time! |
Ok I figured it out. For anyone facing a similar problem, the issue derives from the way your code is transformed. For me, it was because I was using I resolved it by not allowing typescript to make any changes to JSX (i.e. Hope it helps! |
You saved my day @3nvi Thanks for posting how you resolved your issue. Finally I was able to make my TS library run with the SC css prop as well. If anyone stumbles upon this issue and needs another example as reference, check out react-table-library which uses Rollup + TS + SC css prop via babel-plugin-styled-components. |
@3nvi Almost 3 years later you've saved my day as well, thank you! |
Cheers 😃 |
I am creating a styled-system using styled-components. Everything during the development works correctly, after using Rollup to generate my reusable library, CSS prop no longer works.
When importing this into a different library the Button component comes out red.
I am using Rollup with a simple configuration which uses
babel-plugin-styled-component
.Could this be something to do with Rollup? I would assume that once transpiled this should work anywhere?
The text was updated successfully, but these errors were encountered: