Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop importing all of @storybook/icons in @storybook/core #29159

Open
Tracked by #29038
JReinhold opened this issue Sep 19, 2024 · 0 comments
Open
Tracked by #29038

Stop importing all of @storybook/icons in @storybook/core #29159

JReinhold opened this issue Sep 19, 2024 · 0 comments

Comments

@JReinhold
Copy link
Contributor

JReinhold commented Sep 19, 2024

For backwards compatibility, @storybook/icon is imported as * in two places:

  1. The Icons component in @storybook/core/components: https://github.com/storybookjs/storybook/blob/next/code/core/src/components/components/icon/icon.tsx/#L35-L62 this component is deprecated, and the new icons are supposed to be used and imported individually by users/addon authors

  2. The globalisation in @storybook/core/manager/globals: https://github.com/storybookjs/storybook/blob/next/code/core/src/manager/globals/runtime.ts/#L25 Which makes all of @storybook/iconsglobally available in the manager bundle. This ensures that@storybook/icons` is only bundled in once in the manager, but ideally this shouldn't be necessary at all, if icons where imported individually instead.

Currently the components and manager entrypoints of @storybook/core both have all 190kb of @storybook/icons bundled in, which is significant given that icons could instead be imported individually, some being <1kb in size.

In Storybook 9.0 we should remove these wildcard imports so only the used icons are bundled in.

@JReinhold JReinhold changed the title Treeshake @storybook/icons usage in @storybook/core/components Stop importing all of @storybook/icons in @storybook/core Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant