Skip to content

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

Open

Description

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions