This repository has been archived by the owner on Oct 8, 2023. It is now read-only.
generated from Tim-W-James/frontend-ts-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cjs
72 lines (67 loc) · 1.98 KB
/
main.cjs
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
const path = require("path");
const { loadConfigFromFile, mergeConfig } = require("vite");
const AutoImport = require("unplugin-auto-import/vite");
const tsconfigPaths = require("vite-tsconfig-paths").default;
module.exports = {
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
"@storybook/addon-actions",
"@storybook/addon-backgrounds",
"@storybook/addon-controls",
"@storybook/addon-docs",
"@storybook/addon-viewport",
"@storybook/addon-toolbars",
"@storybook/addon-links",
"@storybook/addon-interactions",
"@storybook/addon-measure",
"@storybook/addon-outline",
"@storybook/addon-a11y",
"storybook-addon-react-router-v6",
"storybook_vitest_addon",
],
framework: "@storybook/react",
core: {
builder: "@storybook/builder-vite",
},
features: {
storyStoreV7: true,
},
async viteFinal(config, { configType }) {
const { config: userConfig } = await loadConfigFromFile(
path.resolve(__dirname, "../vite.config.ts")
);
return mergeConfig(config, {
...userConfig,
});
},
// reuse ./vite.config.ts
async viteFinal(config, { configType }) {
const { config: userConfig } = await loadConfigFromFile(
path.resolve(__dirname, "../vite.config.ts")
);
return mergeConfig(config, {
...userConfig,
// manually specify plugins to avoid conflict
plugins: [
AutoImport({
/// targets to transform
include: [
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
/\.md$/, // .md
],
// global imports to register
imports: [
// presets
"vitest",
"react",
],
// Filepath to generate corresponding .d.ts file.
// Defaults to './auto-imports.d.ts' when `typescript` is installed locally.
// Set `false` to disable.
dts: "./types/auto-imports.d.ts",
}),
tsconfigPaths(),
],
});
},
};