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

[Bug] Tree shaking when using the DS library in a host application #346

Open
nebarf opened this issue Mar 30, 2022 · 0 comments
Open

[Bug] Tree shaking when using the DS library in a host application #346

nebarf opened this issue Mar 30, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@nebarf
Copy link

nebarf commented Mar 30, 2022

Describe the bug

I installed storybook DS as a dependency of a sample React app and verified how it affects the final bundle. At a first glance it seems that the library is not tree-shakable, meaning that importing just a single component of the DS results in the entire library being part of the final bundle.

Steps to reproduce the behavior

You can clone the repo at https://github.com/nebarf/storyboook-ds-tree-shaking and just playing with the commented import and jsx (https://github.com/nebarf/storyboook-ds-tree-shaking/blob/main/src/App.js#L3 and https://github.com/nebarf/storyboook-ds-tree-shaking/blob/main/src/App.js#L11). Screenshots below show how the final bundle does not change by importing and using a different set of library components.

Screenshots

Build 1

build-1-1
build-1

Build 2

build-2-1
build-2

Expected behavior

I would expect the library to be fully tree shakable and having only the imported components being part of the application bundle when the library is consumed.

Environment

  • OS: Ubuntu 20.04.4 LTS
  • Node.js version: v17.6.0
  • NPM version:8.5.1
@nebarf nebarf added the bug Something isn't working label Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant