Error triying to use emotion on a Gatsby project.
See original GitHub issueCurrent behavior:
When I try to run gatsby develop it give me this error
WebpackError: The @emotion/core package has been renamed to @emotion/react. Please import it like this import { jsx } from @emotion/react
But I have installed the emotion/core and the emotion/react my imports on the components are:
import React from 'react';
import { Link } from 'gatsby';
import Navegacion from './navegacion';
import { jsx, css } from '@emotion/react';
To reproduce:
https://codesandbox.io/s/emotion-issue-template-forked-7su4k?file=/src/navegacion.js
- run gatsby new project-name
- npm i @emotion/styled @emotion/react gatsby-plugin-emotion
- try to create a styled component
Expected behavior:
Expected behavior? I hope it works as it should, how it worked in older versions.
Environment information:
"dependencies": {
"@emotion/core": "^11.0.0",
"@emotion/react": "^11.1.1",
"@emotion/styled": "^11.0.0",
"gatsby": "^2.26.1",
"gatsby-image": "^2.5.0",
"gatsby-plugin-emotion": "^4.5.0",
"gatsby-plugin-manifest": "^2.6.1",
"gatsby-plugin-offline": "^3.4.0",
"gatsby-plugin-react-helmet": "^3.4.0",
"gatsby-plugin-sharp": "^2.8.0",
"gatsby-source-filesystem": "^2.5.0",
"gatsby-transformer-sharp": "^2.6.0",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-helmet": "^6.1.0"
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Problems with Emotion (Styled Components) on Gatsby
This is happening because in Emotion 11 the package names have changed. I don't believe gatsby-plugin-emotion is up to date yet, ...
Read more >Troubleshooting Common Errors - Gatsby
Errors in styling. Inconsistent CSS styles between develop and build using styled-components or emotion. Errors with GraphQL. Unknown field 'A' on type 'B'....
Read more >gatsby-plugin-manifest - npm
Gatsby plugin which adds a manifest.webmanifest to make sites progressive web apps. Latest version: 4.22.0, last published: 11 days ago. Start using ......
Read more >Why you shouldn't use @emotion/core - Colin McDonnell
If you're using Emotion in your React project, @emotion/core is ... If you want to hear about that when it's ready, join my...
Read more >[Gatsby, Storyblok] "Can't resolve 'fs' in x" - DEV Community
Anyone who got the error says "Can't resolve 'fs' in x" from your Gatsby projects; Anyone who is trying out to arrange things...
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
After moving to
gatsby-plugin-emotion@5.1.0-next.0
and using@emotion/react@11.1.1
, I’m getting the following:My problem was solved on the update of the gatsby plugin, thanks!