Speeding up Storybook with Brotli

Use brotli compression to improve Storybook load times.

Storybook is now on version 10, which makes this post a bit outdated. However, the principles still apply. You can still use brotli compression to improve Storybook load times.

Since Storybook version 6.4, Storybook introduced an on-demand architecture for smaller builds and faster load times. At a high-level, Storybook achieves this performance improvement by loading each story independently rather than packing them into a single monolithic bundle.

Now that we can bundle and lazy-load stories can be independently, I was curious if we could take one more step in optimizing our static story assets. 🤔

My friend, Dustin Younse, recommended I look into brotli, a generic-purpose lossless compression algorithm developed by Google, as a possible solution for further file shrinking.

Dustin and his team found that using brotli compression for their design system Storybook significantly improved load speeds for teams in Tokyo and Singapore (APAC). This may not be an issue if using a low-latency CDN for your teams Storybook. However, brotli compression is an easy integration that might be worth experimenting! 🧪

Adding Brotli

Adding brotli compression to our Storybook configuration is made convenient thanks to the to the brotli-webpack-plugin. First, install the plugin package as a dev dependency.


Then, add the plugin to the webpack config for Storybook.


Build a production-ready version of the Storybook. This is usually the script when using Storybook's default setup:


The output will include files as usual. With the plugin installed, it should now also generate assets which will be preferred and served by brotli compatible static servers.

One way we can test the Storybook output is by using static HTTP server with the or flag enabled. Preview it locally by running the following command:


You can verify the brotli encoding in the the Chrome DevTools Network tab.

Network tab to inspect brotli content encoding.

Subscribe to the newsletter

Be the first to know when I post something new! Thoughts about code, design, startups and other interesting things.

© 2025 Sam Rose
All Rights Reserved.