From 54ce51db00bafd3090ecda66868377c0a4c318d3 Mon Sep 17 00:00:00 2001 From: Bill Glesias Date: Wed, 21 May 2025 13:39:57 -0400 Subject: [PATCH 1/3] chore: add migration guide if needing webpack built-ins --- docs/app/references/migration-guide.mdx | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/app/references/migration-guide.mdx b/docs/app/references/migration-guide.mdx index 361990c436..93bf87e134 100644 --- a/docs/app/references/migration-guide.mdx +++ b/docs/app/references/migration-guide.mdx @@ -86,6 +86,33 @@ As stated earlier, this is likely unnecessary unless you are already using `@cyp Note that this package version is deprecated and no longer supported by Cypress and is intended as a workaround until you can migrate to Webpack `5`. More information on how to configure the preprocessor can be found in the [Preprocessors API documentation](/api/node-events/preprocessors-api#Usage) and [Webpack Preprocessor documentation](https://github.com/cypress-io/cypress/blob/@cypress/webpack-preprocessor-v6.0.4/npm/webpack-preprocessor/README.md). +### `@cypress/webpack-batteries-included-preprocessor` no longer shims all built-ins provided by `webpack` v4 + +The default file preprocessor, `@cypress/webpack-batteries-included-preprocessor`, no longer shims all built-ins that were previously provided by webpack v4. This is mainly to reduce security vulnerabilities and bundle size within the end-to-end file preprocessor. + +However, `@cypress/webpack-batteries-included-preprocessor` still ships with *some* build-ins, such as `buffer`, `path`, `process`, `os`, and `stream`. If others built-ins are required, you will need to install `@cypress/webpack-batteries-included-preprocessor` independently and follow the webpack documentation described in [webpack's resolve.fallback](https://webpack.js.org/configuration/resolve/#resolvefallback) to configure which built-ins you need. + +For example, the following code shows how to provide the `querystring` built-in to the preprocessor: + +```javascript +const webpackPreprocessor = require('@cypress/webpack-batteries-included-preprocessor') + +function getWebpackOptions () { + const options = webpackPreprocessor.getFullWebpackOptions() + + // add built-ins as needed + // NOTE: for this example, querystring-es3 needs to be installed as a dependency + options.resolve.fallback.querystring = require.resolve('querystring-es3') + return options +} + +module.exports = (on) => { + on('file:preprocessor', webpackPreprocessor({ + webpackOptions: getWebpackOptions() + })) +} +``` + ### Angular `17` CT no longer supported With [LTS ending](https://angular.dev/reference/releases#actively-supported-versions) for Angular 17, the minimum required Angular version for component testing is now `18.0.0`. From 73c330f17582dbb4f9b3be0a22f5798f9db1664b Mon Sep 17 00:00:00 2001 From: Bill Glesias Date: Wed, 4 Jun 2025 14:18:15 -0400 Subject: [PATCH 2/3] Update docs/app/references/migration-guide.mdx Co-authored-by: Jennifer Shehane --- docs/app/references/migration-guide.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/app/references/migration-guide.mdx b/docs/app/references/migration-guide.mdx index 93bf87e134..ea68a30f82 100644 --- a/docs/app/references/migration-guide.mdx +++ b/docs/app/references/migration-guide.mdx @@ -90,7 +90,7 @@ Note that this package version is deprecated and no longer supported by Cypress The default file preprocessor, `@cypress/webpack-batteries-included-preprocessor`, no longer shims all built-ins that were previously provided by webpack v4. This is mainly to reduce security vulnerabilities and bundle size within the end-to-end file preprocessor. -However, `@cypress/webpack-batteries-included-preprocessor` still ships with *some* build-ins, such as `buffer`, `path`, `process`, `os`, and `stream`. If others built-ins are required, you will need to install `@cypress/webpack-batteries-included-preprocessor` independently and follow the webpack documentation described in [webpack's resolve.fallback](https://webpack.js.org/configuration/resolve/#resolvefallback) to configure which built-ins you need. +However, `@cypress/webpack-batteries-included-preprocessor` still ships with *some* built-ins, such as `buffer`, `path`, `process`, `os`, and `stream`. If other built-ins are required, install `@cypress/webpack-batteries-included-preprocessor` independently and follow the webpack documentation described in [webpack's resolve.fallback](https://webpack.js.org/configuration/resolve/#resolvefallback) to configure the built-ins you need. For example, the following code shows how to provide the `querystring` built-in to the preprocessor: From 9ae517d48a5c33438959b601deaa25783921eb35 Mon Sep 17 00:00:00 2001 From: Bill Glesias Date: Wed, 4 Jun 2025 14:26:10 -0400 Subject: [PATCH 3/3] run linter --- docs/app/references/migration-guide.mdx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/app/references/migration-guide.mdx b/docs/app/references/migration-guide.mdx index ea68a30f82..121157b1b8 100644 --- a/docs/app/references/migration-guide.mdx +++ b/docs/app/references/migration-guide.mdx @@ -88,16 +88,16 @@ Note that this package version is deprecated and no longer supported by Cypress ### `@cypress/webpack-batteries-included-preprocessor` no longer shims all built-ins provided by `webpack` v4 -The default file preprocessor, `@cypress/webpack-batteries-included-preprocessor`, no longer shims all built-ins that were previously provided by webpack v4. This is mainly to reduce security vulnerabilities and bundle size within the end-to-end file preprocessor. +The default file preprocessor, `@cypress/webpack-batteries-included-preprocessor`, no longer shims all built-ins that were previously provided by webpack v4. This is mainly to reduce security vulnerabilities and bundle size within the end-to-end file preprocessor. -However, `@cypress/webpack-batteries-included-preprocessor` still ships with *some* built-ins, such as `buffer`, `path`, `process`, `os`, and `stream`. If other built-ins are required, install `@cypress/webpack-batteries-included-preprocessor` independently and follow the webpack documentation described in [webpack's resolve.fallback](https://webpack.js.org/configuration/resolve/#resolvefallback) to configure the built-ins you need. +However, `@cypress/webpack-batteries-included-preprocessor` still ships with _some_ built-ins, such as `buffer`, `path`, `process`, `os`, and `stream`. If other built-ins are required, install `@cypress/webpack-batteries-included-preprocessor` independently and follow the webpack documentation described in [webpack's resolve.fallback](https://webpack.js.org/configuration/resolve/#resolvefallback) to configure the built-ins you need. For example, the following code shows how to provide the `querystring` built-in to the preprocessor: ```javascript const webpackPreprocessor = require('@cypress/webpack-batteries-included-preprocessor') -function getWebpackOptions () { +function getWebpackOptions() { const options = webpackPreprocessor.getFullWebpackOptions() // add built-ins as needed @@ -107,9 +107,12 @@ function getWebpackOptions () { } module.exports = (on) => { - on('file:preprocessor', webpackPreprocessor({ - webpackOptions: getWebpackOptions() - })) + on( + 'file:preprocessor', + webpackPreprocessor({ + webpackOptions: getWebpackOptions(), + }) + ) } ```