Installing Emotion 11 breaks storybook-builder-vite
See original GitHub issueTrying to use storybook-builder-vite as the builder when you have Emotion 11 installed breaks docs pages with an Uncaught TypeError: Cannot read properties of undefined (reading 'content')
in one of the MDX/docs pages’ <Styled(div)>
elements because the Emotion theme is empty.
Reproduction
npx sb init --type react
- Initialize storybooknpm install react react-dom storybook-builder-vite
- Add React and storybook-builder-vite- Add
core: { builder: 'storybook-builder-vite' }
to configure storybook-builder-vite npm run storybook
- The Introduction page in Storybook works nownpm install @emotion/react @emotion/styled
- Install Emotion 11npm run storybook
- The Introduction page is now broken
More information
Lots of projects have upgraded to Emotion v11. This includes libraries like MUI, where it’s not possible to just downgrade back to Emotion v10.
Storybook is currently running Emotion v10. However running the normal Webpack4 builder docs pages still work, even when running with features.emotionAlias: false,
to ensure that the project’s own Emotion v11 theme provider works.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Installing Emotion 11 breaks storybook-builder-vite · Issue #219
Storybook is currently running Emotion v10. However running the normal Webpack4 builder docs pages still work, even when running with features.
Read more >Vite - Storybook
Storybook Vite builder bundles your components and stories with Vite, a fast ESM bundler. For applications built with Vite: it allows reusing the...
Read more >storybook-builder-vite - npm
An experimental plugin to run and build Storybooks with Vite. Latest version: 0.1.23, last published: 8 months ago. Start using storybook-builder-vite in ...
Read more >Storybook vite failed to build with ChakraUI / React 18
I used latest version of chakra, react 18, emotion 11 and storybook 6.5 with vite builder. I tried with webpack 4 and 5...
Read more >MIGRATION.md - Storybook - Fossies
Prior to SB6.5, addon-actions provided an option called addDecorators . In SB6.5, decorators are applied always. This is technically a breaking change, so...
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 Free
Top 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
@dantman You should be able to use this solution: https://github.com/storybookjs/storybook/issues/16716#issuecomment-1020613602
I’ve tested it locally and it works, all you need to to is use the viteFinal setup instead.
It looks like storybook is also working on improving their compatibility with emotion 11: https://github.com/storybookjs/storybook/pull/17000