Skip to content
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

emotion macro returns undefined when used as selector #1097

Closed
lifeiscontent opened this issue Dec 11, 2018 · 4 comments · Fixed by #1580
Closed

emotion macro returns undefined when used as selector #1097

lifeiscontent opened this issue Dec 11, 2018 · 4 comments · Fixed by #1580

Comments

@lifeiscontent
Copy link
Contributor

when using the babel macro for @emotion/styled/macro the element returns an undefined selector it should either throw if it cannot be found or return the right selector.

e.g.

import styled from '@emotion/styled/macro';

const ListItem = styled.li();
const List = styled.ul({
    [ListItem]: {
        color: 'green'
    }
});
@emmatown
Copy link
Member

Could you provide a reproduction? It's working in CodeSandbox, https://codesandbox.io/s/10240kz3pl

@lifeiscontent
Copy link
Contributor Author

@mitchellhamilton I'm honestly baffled, I literally copy/pasted the code from my codebase into codesandbox and it works... any ideas on how to debug something like this? in the meantime I'll try to track down the issue on my end.

@lifeiscontent
Copy link
Contributor Author

lifeiscontent commented Dec 11, 2018

@mitchellhamilton okay, I tracked down the issue. it was because the component I was importing wasn't exported. maybe this should throw an error similar to how react does if you render undefined in a component tree and says maybe you forgot to export it?

@Andarist
Copy link
Member

@lifeiscontent I've implemented a warning for this in #1580 . Closing this right now as the PR will most likely be merged soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants