mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-10 00:59:47 -06:00
31 lines
860 B
JavaScript
31 lines
860 B
JavaScript
const { startDevServer } = require('@cypress/webpack-dev-server')
|
|
const findReactScriptsWebpackConfig = require('./findReactScriptsWebpackConfig')
|
|
const { getLegacyDevServer } = require('../utils/legacy-setup-dev-server')
|
|
|
|
function devServer (cypressDevServerConfig, {
|
|
webpackConfigPath,
|
|
indexHtml,
|
|
} = {}) {
|
|
return startDevServer({
|
|
options: cypressDevServerConfig,
|
|
webpackConfig: findReactScriptsWebpackConfig(cypressDevServerConfig.config, {
|
|
webpackConfigPath: webpackConfigPath || 'react-scripts/config/webpack.config',
|
|
}),
|
|
indexHtml,
|
|
})
|
|
}
|
|
|
|
// Legacy signature
|
|
module.exports = getLegacyDevServer(devServer, (config) => {
|
|
config.env.reactDevtools = true
|
|
|
|
return config
|
|
})
|
|
|
|
// New signature
|
|
module.exports.devServer = devServer
|
|
|
|
module.exports.defineDevServerConfig = function (devServerConfig) {
|
|
return devServerConfig
|
|
}
|