You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/generated/packages/storybook/documents/migrate-storybook-7.md
+58-77Lines changed: 58 additions & 77 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ The Storybook CLI will prompt you to run some code generators and modifiers.
52
52
53
53
Say `yes` to the following:
54
54
55
-
-`mainjsFramework`: It will add the `framework` field in your root`.storybook/main.js|ts` file. We are going to delete it since it's not needed in the root file, but it's handy to have it ready to copy. Also, it shows you an indication of what it looks like.
55
+
-`mainjsFramework`: It will try to add the `framework` field in your project's`.storybook/main.js|ts` file.
56
56
-`eslintPlugin`: installs the `eslint-plugin-storybook`
-`autodocsTrue`: we don't need it and it can potentially cause issues with missing dependencies on your Nx workspace
63
63
64
-
### 3. Restore the root `.storybook/main.js|ts` file
65
-
66
-
You will have noticed that the Storybook automigrator added the `framework` option to your root `.storybook/main.js|ts` file. Let's remove that.
67
-
68
-
So, remove:
69
-
70
-
```ts
71
-
framework: {
72
-
name: '@storybook/angular',
73
-
options: {}
74
-
}
75
-
```
76
-
77
-
from your root `.storybook/main.js|ts` file.
78
-
79
64
### 3. Edit all the project-level `.storybook/main.js|ts` files
80
65
81
66
Find all your project-level `.storybook/main.js|ts` files and edit them to add the `framework` option. While you are at it, remove the `builder` from `core` options.
@@ -87,7 +72,7 @@ In your project-level `.storybook/main.js|ts` files, remove the `builder` from `
You must remove the `builder`, or you can also delete the `core` object entirely.
@@ -126,12 +111,16 @@ Choose the `@storybook/angular` framework. So add this in your project-level `.s
126
111
127
112
#### For React projects using `'@storybook/builder-vite'`
128
113
129
-
Choose the `@storybook/react-vite` framework. So add this in your project-level `.storybook/main.js|ts` file:
114
+
Choose the `@storybook/react-vite` framework. You must also point the builder to the Vite configuration file path, so that it can read the settings from there. If your project's root path is `apps/my-app` and it's using a Vite configuration file at `apps/my-app/vite.config.ts`, then you must add this in your project-level `.storybook/main.js|ts` file:
130
115
131
116
```ts
132
117
framework: {
133
118
name: '@storybook/react-vite',
134
-
options: {}
119
+
options: {
120
+
builder: {
121
+
viteConfigPath: 'apps/my-app/vite.config.ts',
122
+
},
123
+
}
135
124
}
136
125
```
137
126
@@ -159,12 +148,16 @@ Choose the `@storybook/nextjs` framework. So add this in your project-level `.st
159
148
160
149
#### For Web Components projects using `'@storybook/builder-vite'`
161
150
162
-
Choose the `@storybook/web-components-vite` framework. So add this in your project-level `.storybook/main.js|ts` file:
151
+
Choose the `@storybook/web-components-vite` framework. You must also point the builder to the Vite configuration file path, so that it can read the settings from there. If your project's root path is `apps/my-app` and it's using a Vite configuration file at `apps/my-app/vite.config.ts`, then you must add this in your project-level `.storybook/main.js|ts` file:
163
152
164
153
```ts
165
154
framework: {
166
155
name: '@storybook/web-components-vite',
167
-
options: {}
156
+
options: {
157
+
builder: {
158
+
viteConfigPath: 'apps/my-app/vite.config.ts',
159
+
},
160
+
}
168
161
}
169
162
```
170
163
@@ -183,79 +176,67 @@ Choose the `@storybook/web-components-webpack5` framework. So add this in your p
183
176
184
177
You can easily find the correct framework by looking at the `builder` option in your project-level `.storybook/main.js|ts` file.
0 commit comments