-
-
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 is breaking build when component comes from imported object #240
Closed
dlehmhus opened this issue
Aug 13, 2019
· 4 comments
· Fixed by #298 or guardian/guardian-engineering-site#112 · May be fixed by tiff-es/tiffanyPortfolio-gatsby-styledcomp#237 or tiff-es/tiffanyPortfolio-gatsby-styledcomp#246
Closed
CSS prop is breaking build when component comes from imported object #240
dlehmhus opened this issue
Aug 13, 2019
· 4 comments
· Fixed by #298 or guardian/guardian-engineering-site#112 · May be fixed by tiff-es/tiffanyPortfolio-gatsby-styledcomp#237 or tiff-es/tiffanyPortfolio-gatsby-styledcomp#246
Comments
Any updates on this? I just ran into it myself. Looks like it was introduced in 1.9.0, so reverting to 1.8.0 is the only workaround I can find. |
Also seeing this behavior |
sfishel18
added a commit
to sfishel18/babel-plugin-styled-components
that referenced
this issue
Aug 19, 2020
this makes sure that other babel transformations that rename variables will be able to process the ast nodes created by this plugin fixes styled-components#240
Looks like the root cause is the JSX member expression, so I think you should be able to work around it like this: import React from "react";
import { css } from "styled-components/macro";
import Icons from "./icons";
const someCss = css` background: purple;`;
const IconFoo = Icon.Foo;
const App: React.FC = () => { return <IconFoo css={someCss} />; }; |
Guys, any news when this could be fixed. PR is working. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
When trying to add
css
to a component that comes from a different file from inside an object, an error gets thrown with the messageUncaught ReferenceError: Icons is not defined
. Strangely the error only occurs in the production build. In development-mode everything is working fine. Also when I move the content of theicons.tsx
inside theapp.tsx
everything is working as expected as well.Setup
Repo with an example setup: https://github.com/dlehmhus/styled-components-with-macro-example
The text was updated successfully, but these errors were encountered: