Skip to content

Trouble passing build.rollupOptions to react-vite #28248

Answered by ento
acobster asked this question in Help
Discussion options

You must be logged in to vote

I hit the same issue and was able to resolve it by updating the server option in the viteFinal callback.

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: server option gets replaced by Storybook's config in its internal createViteServer function:
https://github.com/storybookjs/storybook/blob/v8.4.7/code/builders/builder-vite/src/vite-server.…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@acobster
Comment options

Answer selected by acobster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants