@emotion/babel-plugin@11.3.0 does not support nested component pseudo selectors?
See original GitHub issueCurrent behavior:
To reproduce: https://codesandbox.io/s/determined-snowflake-p3d91?file=/src/App.tsx:0-135
import styled from "@emotion/styled";
const Foo = styled.div``;
const Box = styled.div`
& + ${Foo}::after {
color: red;
}
`;
The above results in
Error
Component selectors can only be used in conjunction with @emotion/babel-plugin.
Expected behavior:
Should not throw an error here
Environment information:
dependencies
"@emotion/babel-plugin": "11.3.0",
"@emotion/react": "11.1.5",
"@emotion/styled": "11.1.5",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-scripts": "4.0.0"
.babelrc (setup according to docs) https://emotion.sh/docs/@emotion/babel-plugin
{
"plugins": [
"@emotion"
]
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to use pseudo selectors in material-ui? - Stack Overflow
I was trying to show/hide my <TreeMenu/> component in the material UI v1 with pseudo selectors but somehow it does not work. Here...
Read more >has() - CSS: Cascading Style Sheets - MDN Web Docs
The :has() pseudo-class cannot be nested within another :has() . This is because many pseudo-elements exist conditionally based on the styling ...
Read more >CSS References · Prince Documentation
CSS Backgrounds and Borders Module Level 3, Prince does not support box-shadow and ... relative selector, A shorthand for selectors that represent elements...
Read more >Meet the Pseudo Class Selectors | CSS-Tricks
The spec says that :not selectors cannot be nested, but they can be chained. Some browsers (Firefox) also support comma-separated selectors ...
Read more >emotion/babel-plugin@11.3.0 does not support nested ...
emotion/babel-plugin@11.3.0 does not support nested component pseudo selectors?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am also experiencing this issue and it is preventing my migration from styled-components. I use only TypeScript and do not want to involve Babel, adding
{ target: "any string at all" }
works as shown in the above comment.@rarenatoe
Andarist 's another demo work for me, NO NEED @emotion/styled/macro
Andarist, many many thanks your hard work