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

Improve performance for larger storybooks #6391

Closed
trevordmiller opened this issue Apr 2, 2019 · 14 comments
Closed

Improve performance for larger storybooks #6391

trevordmiller opened this issue Apr 2, 2019 · 14 comments

Comments

@trevordmiller
Copy link
Contributor

trevordmiller commented Apr 2, 2019

First off, thanks for such a fantastic tool! Our company loves storybook and uses it in hundreds of projects.

Is your feature request related to a problem? Please describe.

Building a storybook with many stories currently leads to webpack performance warnings:

"asset size limit: The following asset(s) exceed the recommended size limit (244 KiB)"

image

Describe the solution you'd like

It would be great if storybook could implement the code splitting recommendations from the webpack team as shown in the error message attached below; under the hood, so all storybook users with default setups could upgrade and benefit from the performance improvements for "free" without extra config.

Describe alternatives you've considered

We have considered extending the default webpack config or using "full control" mode, but would prefer not to "eject" from the default storybook setup. We have also considered breaking up our component library but all the components work together well and it doesn't make sense to break them up from a consuming developer experience.

Are you able to assist bring the feature to reality?

I love contributing to open source! But probably don't have time for this currently unless someone can provide a simple implementation.

Additional context

Using default setup (we are not extending or using "full control" of the default webpack setup) of @storybook/react": "^5.0.3".

@stale
Copy link

stale bot commented Apr 24, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Apr 24, 2019
@trevordmiller
Copy link
Contributor Author

Our organization uses storybook for hundreds of projects and we see this performance warning on many of them.

@stale stale bot removed the inactive label Apr 24, 2019
@stale
Copy link

stale bot commented May 15, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label May 15, 2019
@shilman shilman removed the inactive label May 16, 2019
@trevordmiller
Copy link
Contributor Author

@shilman I noticed you removed the inactive label - is this something that the storybook team plans to address? If this is an isolated problem with our organization, I understand and we can close this issue and try to improve things on our end. But it seems to me with how often we are seeing this warning across the many many storybooks we maintain that perhaps it is a problem for many other teams as well? Would it be possible to code split by default or something, per the link in the web pack warning?

@shilman
Copy link
Member

shilman commented May 16, 2019

@trevordmiller I think this is happening for most storybook users. Nobody is working on it right now, but I don't want performance issues to go stale and get swept under the rug so I "reactivated" it. If anybody wants to give it a go, they are welcome to. Hope at some point we can do a perf-oriented release and tackle this and a bunch of other related issues...

@ndelangen
Copy link
Member

This related to #6806

With the current config.js is real hard to enable code-splitting in an automated fashion.

@shilman shilman modified the milestones: 5.0.x, 5.1.x Jun 5, 2019
@stale
Copy link

stale bot commented Jun 26, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Jun 26, 2019
@stale
Copy link

stale bot commented Jul 26, 2019

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

@johnhunter
Copy link
Contributor

We have the same issue for a different reason. Our Storybook is served from AWS lambda. We recently added IE11 support for our components in Storybook and the additional babel transpilation / polyfilling has pushed the vendor~main over the lambda maximum file size.

@shilman
Copy link
Member

shilman commented Sep 10, 2019

@johnhunter We'll do a perf sprint at some point soon and hopefully can get the bundle size down. In the meantime ... that sucks! @ndelangen any thoughts on options here?

@johnhunter
Copy link
Contributor

Thanks @shilman, we're already appending to the Storybook webpack.config so its pretty straightforward to resolve using webpack-merge. The relevant parts of our webpack.config.js look like this:

const webpack = require('webpack');
const merge = require('webpack-merge');


const maxAssetSize = 1024 * 1024;

module.exports =  async ({ config, mode }) => {
  return merge(config, {
    //...

    optimization: {
      splitChunks: {
        chunks: 'all',
        minSize: 30 * 1024,
        maxSize: maxAssetSize,
      }
    },
    performance: {
      maxAssetSize: maxAssetSize
    }
  });
};

This can produce quite a few bundles on larger projects. If the concern is improve build speed there are a few splitChunk settings you can play with.

@kkomelin
Copy link

kkomelin commented Jul 1, 2020

For those who's in search of how to adjust Storybook webpack config, see Custom Webpack Config section of the Storybook docs.

@EvanCarroll
Copy link

Why is this closed, I'm still getting this error..

@shilman
Copy link
Member

shilman commented Dec 16, 2021

@EvanCarroll have you tried storyStoreV7 in 6.4? https://storybook.js.org/blog/storybook-on-demand-architecture/

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

6 participants