|
1 | | -import type { StorybookConfig } from '@storybook/react-vite' |
2 | | -import { resolve } from 'path' |
| 1 | +import type { StorybookConfig } from "@storybook/react-vite"; |
| 2 | +import { resolve } from "path"; |
3 | 3 |
|
4 | 4 | const config: StorybookConfig = { |
5 | | - stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], |
| 5 | + stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], |
6 | 6 | addons: [ |
7 | | - '@storybook/addon-links', |
8 | | - '@storybook/addon-themes', |
9 | | - '@storybook/addon-docs', |
10 | | - '@storybook/addon-mcp', |
| 7 | + "@storybook/addon-links", |
| 8 | + "@storybook/addon-themes", |
| 9 | + "@storybook/addon-docs", |
| 10 | + "@storybook/addon-mcp", |
11 | 11 | ], |
12 | 12 | framework: { |
13 | | - name: '@storybook/react-vite', |
| 13 | + name: "@storybook/react-vite", |
14 | 14 | options: {}, |
15 | 15 | }, |
16 | 16 | features: { |
17 | 17 | sidebarOnboardingChecklist: false, |
18 | 18 | }, |
19 | | - staticDirs: ['./public'], |
| 19 | + staticDirs: ["./public"], |
20 | 20 | async viteFinal(config) { |
21 | | - const { mergeConfig } = await import('vite') |
| 21 | + const { mergeConfig } = await import("vite"); |
22 | 22 |
|
23 | 23 | return mergeConfig(config, { |
24 | 24 | plugins: [ |
25 | 25 | { |
26 | 26 | // MDX compiler generates file:// imports for pnpm virtual store paths |
27 | 27 | // that Vite can't resolve. Normalize them to absolute paths. |
28 | | - name: 'resolve-file-protocol-imports', |
| 28 | + name: "resolve-file-protocol-imports", |
29 | 29 | resolveId(id) { |
30 | | - if (!id.startsWith('file://')) return |
31 | | - const path = id.slice('file://'.length) |
32 | | - return path.startsWith('/') ? path : resolve(process.cwd(), path) |
| 30 | + if (!id.startsWith("file://")) return; |
| 31 | + const path = id.slice("file://".length); |
| 32 | + return path.startsWith("/") ? path : resolve(process.cwd(), path); |
33 | 33 | }, |
34 | 34 | }, |
35 | 35 | ], |
36 | 36 | optimizeDeps: { |
37 | 37 | // https://github.com/storybookjs/storybook/issues/28542#issuecomment-2268031095 |
38 | 38 | exclude: [ |
39 | | - 'node_modules/.cache/sb-vite', |
40 | | - 'node_modules/.cache/storybook', |
| 39 | + "node_modules/.cache/sb-vite", |
| 40 | + "node_modules/.cache/storybook", |
41 | 41 | ], |
42 | 42 | }, |
43 | | - }) |
| 43 | + }); |
44 | 44 | }, |
45 | | -} |
46 | | -export default config |
| 45 | +}; |
| 46 | +export default config; |
0 commit comments