Before diving into setting up Storybook's builders, let's look at how the CLI configures them. When you initialize Storybook (via
npx storybook init), the CLI automatically detects which builder to use based on your application. For example, if you're working with Vite, it will install the Vite builder. If you're working with Webpack, it installs the Webpack builder based on your current version.
Additionally, you can also provide a flag to Storybook's CLI and specify the builder you want to use:
Storybook uses the Webpack 4 builder by default if you don't specify one. If you want to use a different builder in your application, these docs detail how you can set up Storybook's supported builders.