fix: set correct default when using react-scripts plugin (#20141)

This commit is contained in:
Lachlan Miller
2022-02-10 16:26:20 +10:00
committed by GitHub
parent e7091849f1
commit 9b967e06f5
2 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ const devServer = require('@cypress/react/plugins/react-scripts')
* @type {Cypress.PluginConfig}
*/
module.exports = (on, config) => {
devServer(on, config)
devServer(on, config, {})
// IMPORTANT to return the config object
// with the any changed environment variables
@@ -7,9 +7,11 @@ const { getTranspileFolders } = require('../utils/get-transpile-folders')
const { addFolderToBabelLoaderTranspileInPlace } = require('../utils/babel-helpers')
const { reactScriptsFiveModifications, isReactScripts5 } = require('../../dist/react-scripts/reactScriptsFive')
module.exports = function findReactScriptsWebpackConfig (config, {
webpackConfigPath,
} = { webpackConfigPath: 'react-scripts/config/webpack.config' }) {
module.exports = function findReactScriptsWebpackConfig (config, devServerOptions) {
const webpackConfigPath = (devServerOptions && devServerOptions.webpackConfigPath)
? devServerOptions.webpackConfigPath
: 'react-scripts/config/webpack.config'
// this is required because
// 1) we use our own HMR and we don't need react-refresh transpiling overhead
// 2) it doesn't work with process.env=test @see https://github.com/cypress-io/cypress-realworld-app/pull/832