@@ -215,6 +215,15 @@ module.exports = defineConfig({
215
215
devServer: {
216
216
framework: ' react' ,
217
217
bundler: ' vite' ,
218
+ // optionally pass in vite config
219
+ viteConfig: require (' ./webpack.config' ),
220
+ // or a function - the result is merged with
221
+ // any `vite.config` file that is detected
222
+ viteConfig: async () => {
223
+ // ... do things ...
224
+ const modifiedConfig = await injectCustomConfig (baseConfig)
225
+ return modifiedConfig
226
+ },
218
227
},
219
228
},
220
229
})
@@ -225,12 +234,22 @@ module.exports = defineConfig({
225
234
226
235
``` ts
227
236
import { defineConfig } from ' cypress'
237
+ import customViteConfig from ' ./customConfig'
228
238
229
239
export default defineConfig ({
230
240
component: {
231
241
devServer: {
232
242
framework: ' react' ,
233
243
bundler: ' vite' ,
244
+ // optionally pass in vite config
245
+ viteConfig: customViteConfig ,
246
+ // or a function - the result is merged with
247
+ // any `vite.config` file that is detected
248
+ viteConfig : async () => {
249
+ // ... do things ...
250
+ const modifiedConfig = await injectCustomConfig (baseConfig )
251
+ return modifiedConfig
252
+ },
234
253
},
235
254
},
236
255
})
@@ -260,6 +279,13 @@ module.exports = {
260
279
bundler: ' webpack' ,
261
280
// optionally pass in webpack config
262
281
webpackConfig: require (' ./webpack.config' ),
282
+ // or a function - the result is merged with any
283
+ // webpack.config that is found
284
+ webpackConfig: async () => {
285
+ // ... do things ...
286
+ const modifiedConfig = await injectCustomConfig (baseConfig)
287
+ return modifiedConfig
288
+ },
263
289
},
264
290
},
265
291
}
@@ -279,6 +305,13 @@ export default defineConfig({
279
305
bundler: ' webpack' ,
280
306
// optionally pass in webpack config
281
307
webpackConfig ,
308
+ // or a function - the result is merged with any
309
+ // webpack.config that is found
310
+ webpackConfig : async () => {
311
+ // ... do things ...
312
+ const modifiedConfig = await injectCustomConfig (baseConfig )
313
+ return modifiedConfig
314
+ },
282
315
},
283
316
},
284
317
})
@@ -472,6 +505,13 @@ module.exports = {
472
505
bundler: ' webpack' ,
473
506
// optionally pass in webpack config
474
507
webpackConfig: require (' ./webpack.config' ),
508
+ // or a function - the result is merged with any
509
+ // webpack.config that is found
510
+ webpackConfig: async () => {
511
+ // ... do things ...
512
+ const modifiedConfig = await injectCustomConfig (baseConfig)
513
+ return modifiedConfig
514
+ },
475
515
},
476
516
},
477
517
}
@@ -491,6 +531,11 @@ export default defineConfig({
491
531
bundler: ' webpack' ,
492
532
// optionally pass in webpack config
493
533
webpackConfig ,
534
+ webpackConfig : async () => {
535
+ // ... do things ...
536
+ const modifiedConfig = await injectCustomConfig (baseConfig )
537
+ return modifiedConfig
538
+ },
494
539
},
495
540
},
496
541
})
@@ -675,6 +720,12 @@ module.exports = {
675
720
bundler: ' webpack' ,
676
721
// optionally pass in webpack config
677
722
webpackConfig: require (' ./webpack.config' ),
723
+ // or a function - the result is merged with the base config
724
+ webpackConfig: async () => {
725
+ // ... do things ...
726
+ const modifiedConfig = await injectCustomConfig (baseConfig)
727
+ return modifiedConfig
728
+ },
678
729
},
679
730
},
680
731
}
0 commit comments