Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add dev server function config API #4699

Merged
merged 3 commits into from
Sep 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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