Skip to content

Commit

Permalink
docs: add dev server function config API (#4699)
Browse files Browse the repository at this point in the history
* docs: add dev server function config API

* update docs
  • Loading branch information
lmiller1990 committed Sep 22, 2022
1 parent 4e2f2b2 commit 2173300
Showing 1 changed file with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,15 @@ module.exports = defineConfig({
devServer: {
framework: 'react',
bundler: 'vite',
// optionally pass in vite config
viteConfig: require('./webpack.config'),
// or a function - the result is merged with
// any `vite.config` file that is detected
viteConfig: async () => {
// ... do things ...
const modifiedConfig = await injectCustomConfig(baseConfig)
return modifiedConfig
},
},
},
})
Expand All @@ -225,12 +234,22 @@ module.exports = defineConfig({

```ts
import { defineConfig } from 'cypress'
import customViteConfig from './customConfig'

export default defineConfig({
component: {
devServer: {
framework: 'react',
bundler: 'vite',
// optionally pass in vite config
viteConfig: customViteConfig,
// or a function - the result is merged with
// any `vite.config` file that is detected
viteConfig: async () => {
// ... do things ...
const modifiedConfig = await injectCustomConfig(baseConfig)
return modifiedConfig
},
},
},
})
Expand Down Expand Up @@ -260,6 +279,13 @@ module.exports = {
bundler: 'webpack',
// optionally pass in webpack config
webpackConfig: require('./webpack.config'),
// or a function - the result is merged with any
// webpack.config that is found
webpackConfig: async () => {
// ... do things ...
const modifiedConfig = await injectCustomConfig(baseConfig)
return modifiedConfig
},
},
},
}
Expand All @@ -279,6 +305,13 @@ export default defineConfig({
bundler: 'webpack',
// optionally pass in webpack config
webpackConfig,
// or a function - the result is merged with any
// webpack.config that is found
webpackConfig: async () => {
// ... do things ...
const modifiedConfig = await injectCustomConfig(baseConfig)
return modifiedConfig
},
},
},
})
Expand Down Expand Up @@ -472,6 +505,13 @@ module.exports = {
bundler: 'webpack',
// optionally pass in webpack config
webpackConfig: require('./webpack.config'),
// or a function - the result is merged with any
// webpack.config that is found
webpackConfig: async () => {
// ... do things ...
const modifiedConfig = await injectCustomConfig(baseConfig)
return modifiedConfig
},
},
},
}
Expand All @@ -491,6 +531,11 @@ export default defineConfig({
bundler: 'webpack',
// optionally pass in webpack config
webpackConfig,
webpackConfig: async () => {
// ... do things ...
const modifiedConfig = await injectCustomConfig(baseConfig)
return modifiedConfig
},
},
},
})
Expand Down Expand Up @@ -675,6 +720,12 @@ module.exports = {
bundler: 'webpack',
// optionally pass in webpack config
webpackConfig: require('./webpack.config'),
// or a function - the result is merged with the base config
webpackConfig: async () => {
// ... do things ...
const modifiedConfig = await injectCustomConfig(baseConfig)
return modifiedConfig
},
},
},
}
Expand Down

1 comment on commit 2173300

@vercel
Copy link

@vercel vercel bot commented on 2173300 Sep 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.