question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve performance for larger storybooks

See original GitHub issue

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".

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:15
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

17reactions
johnhuntercommented, Sep 11, 2019

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.

2reactions
shilmancommented, 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…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Storybook Lazy Compilation for Webpack - JS.ORG
We want to keep improving the performance of Storybook, both for large and smaller projects. Some strategies we'll be investigating: Predictive ...
Read more >
7 Books That Will Help You Improve Your Performance At Work
7 Books That Will Help You Improve Your Performance At Work ; 1. · by Jerry Connor and Karim Hirani ; 2. ·...
Read more >
Optimize performance in your iBooks Author books
Although you can distribute larger books for free through other channels, keep the size down for best results and to avoid performance issues....
Read more >
Ladle vs. Storybook: Measuring performance across project ...
In the case of Storybook, we can once again observe that the startup time increases as the size of the project increases, even...
Read more >
Speeding up Storybook locally by running filtered stories
Working on a big monorepo means that developing with Storybook can become painfully slow. A small change can drastically speed it up!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found