Error when using styled-component macro with gatsby
See original GitHub issueEnvironment
System:
- OS: macOS 10.14.5
- CPU: (4) x64 Intel® Core™ i7-7567U CPU @ 3.50GHz
- Memory: 386.38 MB / 16.00 GB
- Shell: 5.6.1 - /usr/local/bin/zsh
Binaries:
- Node: 10.16.0 - ~/.volta/tools/image/node/10.16.0/6.9.0/bin/node
- Yarn: 1.16.0 - ~/.volta/tools/image/yarn/1.16.0/bin/yarn
- npm: 6.9.0 - ~/.volta/tools/image/node/10.16.0/6.9.0/bin/npm
- Watchman: 4.9.0 - /usr/local/bin/watchman
npmPackages:
- styled-components: ^5.0.0-beta.3 => 5.0.0-beta.3
Steps to reproduce
- start a project with gatsby starter
- install styled-component. same error on v4 and v5
- In a component, try:
import styled from "styled-components/macro";
const RedDiv = styled.div`
color: red;
`;
Expected Behavior
- No error when running
gatsby develop
Actual Behavior
- I see this error in the console:
error There was an error trying to load the config "styledComponents" for the macro imported from "styled-components/macro. Please see the error thrown for more information.
- The code still compiles and works
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:11
Top Results From Across the Web
Tooling - styled-components
By adding a unique identifier to every styled component, this plugin avoids checksum mismatches due to different class generation on the client and...
Read more >Cannot access 'Component' before initialization - Stack Overflow
This error appears when you try to style a Child component that has been defined after its parent.
Read more >Could not find declaration file for 'styled-components'
The error "could not find declaration file for module 'styled-components'" occurs when TypeScript cannot find the type declaration for a styled-components- ...
Read more >gatsby-typescript-tailwind-twin.macro-styled-component-starter
DevHausStudio/Gatsby-Typescript-Tailwind-Twin-Styled-Component-Starter. This Sandbox is in sync with master on GitHub. You have to fork to make changes
Read more >Twin.macro Tutorial for Beginners: Styling with Tailwind CSS ...
We are all done. Next, we will make use of twin.macro to create and style components. Note, to set up VSCode to give...
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
Adding config section to
package.json
fixed itabove fix also works with create-react-app 🙏