Styled components not working in IE11
See original GitHub issueEnvironment
System:
- OS: Windows 10
- CPU: x64 Intel® Core™ i7-7700 CPU @ 3.60GHz
- Memory: 4.90 GB / 15.94 GB
Binaries:
- Node: 8.11.3
- Yarn: 1.7.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
- npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
npmPackages:
- styled-components: ^4.0.3 => 4.0.3
Browser
- IE 11.345.17134.0
Reproduction
Use styled components, extend components like:
export const Flex = styled.div`
display: flex;
`;
export const ResponsiveFlex = styled(Flex)`
@media (max-width: 1024px) {
flex-direction: column;
}
`;
Expected Behavior
No errors in IE 11, components are rendered and extended successfully.
Actual Behavior
Error: Cannot create styled-component for component: .Flex
Console stacktrace:
Issue Analytics
- State:
- Created 5 years ago
- Comments:28 (10 by maintainers)
Top Results From Across the Web
styled-components - IE11 support - Invalid characters
I've added import 'core-js'; import 'react-app-polyfill/ie11'; import 'react-app-polyfill/stable'; to index. js and ie-11 in package. json in section ...
Read more >Styled Components and CSS-Vars in IE11 - CodeSandbox
Styled Components and CSS-Vars in IE11 ... Activating extension 'vscode.typescript-language-features' failed: Could not find bundled tsserver.js.
Read more >Complete Guide On How To Use Styled-components In React
It's a component that is styled not by using a CSS file, but by using CSS syntax in JavaScript (components to be precise)....
Read more >How To Use React Styled Components Efficiently - Copycat
But, our styles won't work just yet. We need to replace the button tag with our styled component, ButtonStyles. 1. 2. 3.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
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
We had the same issue in IE11
it turned out that the issue of inheriting styles was the problem:
create-react-app (react-scripts 2.0.5) styled-components: 4.1.1
we also polyfill with core-js: 1.2.7
by doing
i hope this helps.
edit: Just found out that when importing core-js polyfills at the very start of the app, the issue goes away…
I have this issue