Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

1.4 KB
Raw Blame
import type { StorybookConfig } from "@storybook/react-vite";

const config: StorybookConfig = {
  stories: [
    "../src/components/v3/**/*.mdx",
    "../src/components/v3/**/*.stories.@(js|jsx|mjs|ts|tsx)"
  ],
  addons: ["@storybook/addon-docs", "@storybook/addon-a11y", "storybook-addon-tag-badges"],
  tags: {
    deprecated: {}
  },
  framework: {
    name: "@storybook/react-vite",
    options: {}
  },
  viteFinal: async (viteConfig) => {
    // The main app's vite.config.ts uses experimental.renderBuiltUrl to route
    // asset URLs through window.__toCdnUrl(...), a runtime function injected
    // by the standalone Docker deployment's serving layer. Storybook's static
    // deploy (e.g. Render) has no such injection, so strip the override and
    // let Vite emit plain relative URLs.
    const { renderBuiltUrl, ...experimental } = viteConfig.experimental ?? {};
    return {
      ...viteConfig,
      experimental,
      optimizeDeps: {
        ...viteConfig.optimizeDeps,
        // Injected by vite-plugin-node-polyfills after the dependency scan; finding them on the
        // first page load re-bundles deps and force-reloads, which leaves Firefox's preview stuck.
        include: [
          ...(viteConfig.optimizeDeps?.include ?? []),
          "vite-plugin-node-polyfills/shims/buffer",
          "vite-plugin-node-polyfills/shims/global",
          "vite-plugin-node-polyfills/shims/process"
        ]
      }
    };
  }
};
export default config;