@@ -144,24 +144,12 @@ const config: StorybookConfig = {
144
144
presets: Array < string | [string , any ]> ,
145
145
// ... other compatible babel options
146
146
}
147
- include : Array < string | RegExp > ,
148
- exclude: Array < string | RegExp > ,
147
+ include : Array < string | RegExp > ,
148
+
149
+ // default excludes: /\/node_modules\/(?!react-native|@react-native|expo|@expo)/;
150
+ exclude: Array < string | RegExp > ,
149
151
// ... other compatible @vitejs/plugin-react options
150
152
}
151
-
152
- // these options are used to configure transpilation of node_modules via babel
153
- // in most cases, you don't need to configure these options, but they are available if you need them
154
- pluginBabelOptions : {
155
- include: Array < string | RegExp > , // default: [/node_modules\/(react-native|@react-native)/]
156
- exclude: Array < string | RegExp > , // default: undefined
157
- presets: Array < string | [string , any ]> ,
158
- plugins: Array < string | [string , any ]> ,
159
- presetReact?: {
160
- runtime?: ' automatic' | ' classic' ; // default: 'automatic'
161
- importSource ?: string ; // default: 'react'
162
- };
163
- // ... other compatible vite-plugin-babel options
164
- }
165
153
},
166
154
},
167
155
};
@@ -210,6 +198,26 @@ const main: StorybookConfig = {
210
198
}
211
199
```
212
200
201
+ #### Example configuration to transpile additional node_modules
202
+
203
+ Lets say you need to transpile a library called ` my-library ` that is not included in the default excludes.
204
+ You can do so by overriding the ` exclude ` option.
205
+
206
+ ``` ts title=".storybook/main.ts"
207
+ const main: StorybookConfig = {
208
+ // ... rest of config
209
+
210
+ framework: {
211
+ name: " @storybook/react-native-web-vite" ,
212
+ options: {
213
+ pluginReactOptions: {
214
+ exclude: / \/ node_modules\/ (?!react-native| @react-native| expo| @expo| my-library)/ ;
215
+ },
216
+ },
217
+ },
218
+ }
219
+ ```
220
+
213
221
#### ` builder `
214
222
215
223
Type: ` Record<string, any> `
0 commit comments