Docz: Module not found: Can't resolve 'emotion' after upgrading to emotion 10.0

Created on 10 Jan 2019  路  8Comments  路  Source: doczjs/docz

Bug Report

Describe the bug
After upgrading my project and components to use the newest version of emotion, i get the following error when i try to run docz

./src/App/UI/components/PanelTabs/PanelTabs.js Module not found: Can't resolve 'emotion' in '/Users/bringel/source/snowdrop-web/src/App/UI/components/PanelTabs'

That file doesn't try to import anything from emotion. Its emotion imports look like this:

import { css, jsx } from '@emotion/core';
import styled from '@emotion/styled';

To Reproduce

Upgrade to emotion 10
Run docz:dev

In order to allow us to quickly reproduce you issue please include a link to a reproduction repository.

Expected behavior

A clear and concise description of what you expected to happen..

Environment

  • OS: OS X 10.14
  • Node/npm version: Node 11.1 npm 6.4.1 yarn 1.10.1
  • docz 0.13.7
  • @emotion/core 10.0.5

Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.

question stale v0

All 8 comments

I did a quick test this morning, this appears to be related to using the /** @jsx jsx */ statement to set the pragma at the top of the file. If I remove that statement, the file no longer errors, is there another way I should be setting the jsx pragma?

I did eventually getting this to work by adding emotion to my dev dependencies. Not sure what exactly is requiring it, my app built fine without that dependency before

I have a similar problem with import local module and have a similar error trying to use the component-docs.

Same problem here, but unrelated to docz. We are however using @emotion/babel-preset-css-prop to avoid having to manually override the pragma. Not a single emotion reference in the project code, but running into the same Module not found: Can't resolve 'emotion' when running a production build, and only on the CI env.

Did any of you figure this out without adding an explicit emotion dependency?

I had the same error after upgrading from emotion 9 to emotion 10 (not using docz though). Turned out I forgot to also update babel-plugin-emotion. Upgrading this fixed the issue for me.
Hope this helps others who stumble on this issue.

I had a similar issue, I install react-spinner and problem solved...!
npm install react-spinners --save

probably you need to install @emotion/styled i got the same issue and it was solved doing that

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

YardWill picture YardWill  路  3Comments

tsnolan23 picture tsnolan23  路  3Comments

ssylvia picture ssylvia  路  3Comments

albinekb picture albinekb  路  3Comments

mquandalle picture mquandalle  路  3Comments