Skip to content

Commit 2635ffb

Browse files
chore: add migration guide for@cypress/webpack-batteries-included-preprocessor built-ins removal (#6192)
* chore: add migration guide if needing webpack built-ins * Update docs/app/references/migration-guide.mdx Co-authored-by: Jennifer Shehane <[email protected]> * run linter --------- Co-authored-by: Jennifer Shehane <[email protected]>
1 parent 214bcf2 commit 2635ffb

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

docs/app/references/migration-guide.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,36 @@ As stated earlier, this is likely unnecessary unless you are already using `@cyp
8686

8787
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).
8888

89+
### `@cypress/webpack-batteries-included-preprocessor` no longer shims all built-ins provided by `webpack` v4
90+
91+
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.
92+
93+
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.
94+
95+
For example, the following code shows how to provide the `querystring` built-in to the preprocessor:
96+
97+
```javascript
98+
const webpackPreprocessor = require('@cypress/webpack-batteries-included-preprocessor')
99+
100+
function getWebpackOptions() {
101+
const options = webpackPreprocessor.getFullWebpackOptions()
102+
103+
// add built-ins as needed
104+
// NOTE: for this example, querystring-es3 needs to be installed as a dependency
105+
options.resolve.fallback.querystring = require.resolve('querystring-es3')
106+
return options
107+
}
108+
109+
module.exports = (on) => {
110+
on(
111+
'file:preprocessor',
112+
webpackPreprocessor({
113+
webpackOptions: getWebpackOptions(),
114+
})
115+
)
116+
}
117+
```
118+
89119
### Angular `17` CT no longer supported
90120

91121
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`.

0 commit comments

Comments
 (0)