-
SummaryI am using the
This takes a long time and the browser page just spins in the meantime, making it cumbersome to start.
I figured the problem was that Vite/Rollup needed to be told not to watch those files, so following the Vite build docs I tried to add an Additional informationI am on Ubuntu 22.04 running Storybook v8.1.6. My .storybook/main.js: /** @type { import('@storybook/react-vite').StorybookConfig } */
const config = {
stories: [
"../marx/stories/*.stories.@(js|jsx)",
],
addons: [
"@storybook/addon-onboarding",
"@storybook/addon-links",
"@storybook/addon-essentials",
"@chromatic-com/storybook",
"@storybook/addon-interactions",
"@storybook/addon-themes",
],
framework: {
name: "@storybook/react-vite",
},
core: {
builder: {
name: '@storybook/builder-vite',
options: {
build: {
watch: {
exclude: ['.direnv/**'],
},
},
},
},
},
};
export default config; Instead of the above options: {
watch: {
exclude: ['.direnv/**'],
},
}, (Storybook's Vite builder docs are not super clear on how to do this.) I also tried putting a import {defineConfig} from 'vite';
export default defineConfig({
build: {
rollupOptions: {
watch: {
exclude: ['.direnv/**'],
},
},
},
}); I tried the above both with and without the All of this resulted in the same errors about too many file watchers. Create a reproductionNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I hit the same issue and was able to resolve it by updating the import type { StorybookConfig } from '@storybook/react-vite';
import { mergeConfig } from 'vite';
const config: StorybookConfig = {
// ...
async viteFinal(config) {
config.server = {
...config.server,
watch: {
ignored: ['**/terraform/**', '**/.direnv/**'],
},
};
return mergeConfig(config, {
// ...
});
},
};
export default config; Relevant code: |
Beta Was this translation helpful? Give feedback.
I hit the same issue and was able to resolve it by updating the
server
option in theviteFinal
callback.Relevant code:
server
option gets replaced by Storybook's config in its internalcreateViteServer
function:https://github.com/storybookjs/storybook/blob/v8.4.7/code/builders/builder-vite/src/vite-server.…