fix(npm/react): webpack config sample bug (#16737)

Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
This commit is contained in:
Shunfang Lan
2021-06-04 07:22:28 -07:00
committed by GitHub
parent 887f60ab96
commit 98fe58cce3
+9 -3
View File
@@ -59,9 +59,15 @@ If you have your own Webpack config, you can use included plugins file to load i
```js
// cypress/plugins/index.js
module.exports = (on, config) => {
// from the root of the project (folder with cypress.json file)
config.env.webpackFilename = 'webpack.config.js'
require('@cypress/react/plugins/load-webpack')(on, config)
// the path is relative to cypress.json
const webpackFilename = './src/webpack.config.js'
// configuration
config.env.webpackFilename = webpackFilename
config.env.coverage = false
require('@cypress/react/plugins/load-webpack')(on, config, {webpackFilename})
// IMPORTANT to return the config object
// with the any changed environment variables
return config