You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I discovered that TypeScript lets me set the css prop from Emotion on any components and DOM elements in my app. The problem is that I don't use Emotion at all in that app. The type is incorrect and would therefore break the app at runtime.
I'm writing this issue here because Storybook is depending on Emotion v10, causing the issue.
❯ yarn why @emotion/core
yarn why v1.22.11
[1/4] 🤔 Why do we have the module "@emotion/core"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
=> Found "@emotion/[email protected]"
info Reasons this module exists
- "@storybook#addon-actions#@storybook#theming" depends on it
- Hoisted from "@storybook#addon-actions#@storybook#theming#@emotion#core"
- Hoisted from "@storybook#addon-essentials#@storybook#addon-docs#@storybook#builder-webpack4#@storybook#ui#@emotion#core"
info Disk size without dependencies: "576KB"
info Disk size with unique dependencies: "3.69MB"
info Disk size with transitive dependencies: "11.28MB"
info Number of shared dependencies: 42
✨ Done in 0.83s.
The problem is a known issue of Emotion v10 and was fixed in Emotion v11. So I think this could be solved by upgrading to Emotion v11 internally in Storybook.
Maybe related to #13491 as I see "Emotion@11" in there.
dcastil
changed the title
Storybook polluting global scope of types of non-storybook app
Storybook polluting global type scope of non-storybook app
Oct 19, 2021
Describe the bug
I discovered that TypeScript lets me set the
css
prop from Emotion on any components and DOM elements in my app. The problem is that I don't use Emotion at all in that app. The type is incorrect and would therefore break the app at runtime.I'm writing this issue here because Storybook is depending on Emotion v10, causing the issue.
The problem is a known issue of Emotion v10 and was fixed in Emotion v11. So I think this could be solved by upgrading to Emotion v11 internally in Storybook.
To Reproduce
yarn create react-app storybook-app --template typescript cd storybook-app npx sb init
Now you can add a
css
prop to any React component in the storybook-app project.Current workaround
I managed to fix it temporarily for myself by executing
in a postinstall script.
System
Anyways, much ❤️ to Storybook. Love using it!
The text was updated successfully, but these errors were encountered: