-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
feat: custom webpack config for react/plugins/babel #16597
feat: custom webpack config for react/plugins/babel #16597
Conversation
Allow babel loader options to be configurable to support running within a monorepo. Fixes cypress-io#16596
Thanks for taking the time to open a PR!
|
cc @bahmutov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done, just need to revert the change in cypress.schema.json
and we can merge this up. It'll be available immediately after merging via semantic release.
cli/schema/cypress.schema.json
Outdated
@@ -278,6 +278,11 @@ | |||
"type": "boolean", | |||
"default": false, | |||
"description": "Enables including elements within the shadow DOM when using querying commands (e.g. cy.get(), cy.find()). Can be set globally in cypress.json, per-suite or per-test in the test configuration object, or programmatically with Cypress.config()" | |||
}, | |||
"babelLoaderOptions": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed, this file is for the options in cypress.json
. Docs here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lmiller1990 ah ok, I had assumed that it could also be passed in via cypress.json (as the config would get forwarded) but it appears it is filtered out.
Is this still the right way to pass non global config? Or should it be in a separate param?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reverted the change and pushed
This reverts commit 0a39322.
@lmiller1990 I have also realised it may be handy to configure other parameters, such as adding Will have a think if there's a better way of doing this that allows a little more flexibility. |
Ok so react/plugins/load-webpack/index accepts a 3rd argument for its config. I have mirrored this by adding a third argument to react/plugins/babel/index.js that allows an optional function to be specified to make edits to the webpack config. |
* Allow babel loader options to be configurable Allow babel loader options to be configurable to support running within a monorepo. Fixes cypress-io#16596 * new configuration option in cypress.schema.json * Revert "new configuration option in cypress.schema.json" This reverts commit 0a39322. * support custom webpack configuration via config function * fix linting issue * Update getBabelWebpackConfig.js * linting Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
* Allow babel loader options to be configurable Allow babel loader options to be configurable to support running within a monorepo. Fixes cypress-io#16596 * new configuration option in cypress.schema.json * Revert "new configuration option in cypress.schema.json" This reverts commit 0a39322. * support custom webpack configuration via config function * fix linting issue * Update getBabelWebpackConfig.js * linting Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
User facing changelog
Allow wepback config in @cypress/react/plugins/babel to be configurable to support running within a monorepo.
Additional details
If running Cypress within a monorepo, babel will not search upwards beyond the working directory to find the babel config, and will fail to transpile most code including JSX.
https://babeljs.io/docs/en/config-files#monorepos
How has the user experience changed?
Usage:
PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?