-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.ts
More file actions
57 lines (51 loc) · 1.47 KB
/
main.ts
File metadata and controls
57 lines (51 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import type { StorybookConfig } from "@storybook/react-vite"
import svgr from "vite-plugin-svgr"
import { createRequire } from "node:module"
import { join, dirname } from "path"
// Silliness due to ESM vs Common in the node ecosystem
// !! Check for removal when node version is bumped (current 23)
const require = createRequire(import.meta.url)
const rootDirectory = "../../../"
/**
* This function is used to resolve the absolute path of a package.
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
*/
function getAbsolutePath(value: string): any {
return dirname(require.resolve(join(value, "package.json")))
}
const config: StorybookConfig = {
stories: [join(dirname("."), rootDirectory, "ui/components/**/*.story.tsx")],
addons: [],
staticDirs: [join(dirname("."), rootDirectory, "clients/web/public")],
framework: {
name: getAbsolutePath("@storybook/react-vite"),
options: {},
},
core: {
builder: "@storybook/builder-vite",
disableTelemetry: true,
},
features: {
experimentalRSC: true,
},
async viteFinal(config) {
const { mergeConfig } = await import("vite")
config.resolve = config.resolve || {}
config.resolve.alias = {
...(config.resolve.alias || {}),
}
config.esbuild = {
jsx: "automatic",
}
return mergeConfig(config, {
plugins: [
svgr({
svgrOptions: {
svgo: false,
},
}),
],
})
},
}
export default config