DeveloperBreeze

Vite Programming Tutorials, Guides & Best Practices

Explore 4+ expertly crafted vite tutorials, components, and code examples. Stay productive and build faster with proven implementation strategies and design patterns from DeveloperBreeze.

Automatically Detect New Components in Storybook Without Restarting the Server

Tutorial October 10, 2024
javascript

To ensure new files are detected in real time, you need to configure Webpack’s watchOptions in your Storybook setup. Open your .storybook/main.js file and add the following:

// .storybook/main.js
module.exports = {
  webpackFinal: async (config) => {
    config.watchOptions = {
      aggregateTimeout: 200, // Delay before rebuilding after a change
      poll: 1000,            // Poll the files every second
    };
    return config;
  },
};