Skip to content

Commit 7052458

Browse files
Merge pull request #23 from storybookjs/valentin/fix-optimize-dep-issue
fix: Optimize dependencies to fix hot reloading issues when switching between stories
2 parents a10c55c + a4630d6 commit 7052458

File tree

19 files changed

+1472
-2383
lines changed

19 files changed

+1472
-2383
lines changed

example/.storybook/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const config: StorybookConfig = {
77
"@storybook/addon-links",
88
"@storybook/addon-essentials",
99
"@chromatic-com/storybook",
10-
"@storybook/addon-interactions",
10+
"@storybook/experimental-addon-test",
1111
],
1212
framework: {
1313
name: "@storybook/experimental-nextjs-vite",

example/.storybook/preview.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const preview: Preview = {
1616
date: /Date$/i,
1717
},
1818
},
19+
react: { rsc: true },
1920
},
2021
};
2122

example/.storybook/storybook.setup.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

example/.storybook/vitest.config.mts

Lines changed: 0 additions & 30 deletions
This file was deleted.

example/.storybook/vitest.setup.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { setProjectAnnotations } from "@storybook/experimental-nextjs-vite";
2+
import { beforeAll } from "vitest";
3+
import * as projectAnnotations from "./preview";
4+
5+
// This is an important step to apply the right configuration when testing your stories.
6+
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
7+
const project = setProjectAnnotations([projectAnnotations]);
8+
9+
beforeAll(project.beforeAll);

example/package.json

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,24 @@
2121
"styled-jsx": "^5.1.6"
2222
},
2323
"devDependencies": {
24-
"@chromatic-com/storybook": "^2.0.2",
25-
"@storybook/addon-actions": "^8.3.1",
26-
"@storybook/addon-essentials": "^8.3.1",
27-
"@storybook/addon-interactions": "^8.3.1",
28-
"@storybook/addon-links": "^8.3.1",
29-
"@storybook/addon-onboarding": "^8.3.1",
30-
"@storybook/addon-toolbars": "^8.3.1",
31-
"@storybook/blocks": "^8.3.1",
32-
"@storybook/experimental-addon-test": "^8.3.1",
33-
"@storybook/experimental-nextjs-vite": "^8.3.1",
34-
"@storybook/react": "^8.3.1",
35-
"@storybook/test": "^8.3.1",
24+
"@chromatic-com/storybook": "^3.2.2",
25+
"@storybook/addon-actions": "^8.4.1",
26+
"@storybook/addon-essentials": "^8.4.1",
27+
"@storybook/addon-links": "^8.4.1",
28+
"@storybook/addon-onboarding": "^8.4.1",
29+
"@storybook/addon-toolbars": "^8.4.1",
30+
"@storybook/blocks": "^8.4.1",
31+
"@storybook/experimental-addon-test": "^8.4.1",
32+
"@storybook/experimental-nextjs-vite": "^8.4.1",
33+
"@storybook/react": "^8.4.1",
34+
"@storybook/test": "^8.4.1",
3635
"@testing-library/dom": "^10.3.2",
3736
"@testing-library/jest-dom": "^6.4.6",
3837
"@testing-library/react": "^16.0.0",
3938
"@types/node": "^20",
4039
"@types/react": "^18",
4140
"@types/react-dom": "^18",
42-
"@vitest/browser": "^2.0.5",
41+
"@vitest/browser": "^2.1.4",
4342
"autoprefixer": "^10.4.19",
4443
"bootstrap": "^5.3.3",
4544
"chromatic": "^11.7.0",
@@ -48,10 +47,10 @@
4847
"playwright": "^1.45.3",
4948
"postcss": "^8.4.38",
5049
"serve": "^14.2.3",
51-
"storybook": "^8.3.1",
50+
"storybook": "^8.4.1",
5251
"tailwindcss": "^3.4.4",
5352
"typescript": "^5",
5453
"vite-plugin-inspect": "^0.8.5",
55-
"vitest": "^2.0.5"
54+
"vitest": "^2.1.4"
5655
}
5756
}

example/vitest.config.mts

Lines changed: 0 additions & 16 deletions
This file was deleted.

example/vitest.config.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { storybookTest } from "@storybook/experimental-addon-test/vitest-plugin";
2+
import { storybookNextJsPlugin } from "@storybook/experimental-nextjs-vite/vite-plugin";
3+
import { defineConfig } from "vitest/config";
4+
5+
// More info at: https://storybook.js.org/docs/writing-tests/vitest-plugin
6+
export default defineConfig({
7+
plugins: [
8+
// See options at: https://storybook.js.org/docs/writing-tests/vitest-plugin#storybooktest
9+
storybookTest({ configDir: ".storybook" }),
10+
storybookNextJsPlugin(),
11+
],
12+
test: {
13+
name: "storybook",
14+
browser: {
15+
enabled: true,
16+
headless: true,
17+
name: "chromium",
18+
provider: "playwright",
19+
},
20+
// Make sure to adjust this pattern to match your stories files.
21+
include: ["**/*.stories.?(m)[jt]s?(x)"],
22+
setupFiles: [".storybook/vitest.setup.ts"],
23+
},
24+
});

example/vitest.setup.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

example/vitest.workspace.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)