Skip to content

Commit

Permalink
fix(npm/react): webpack config sample bug (#16737)
Browse files Browse the repository at this point in the history
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
  • Loading branch information
lanshunfang and lmiller1990 committed Jun 4, 2021
1 parent 887f60a commit 98fe58c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions npm/react/docs/recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 98fe58c

Please sign in to comment.