-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Open
Description
Current behavior
Cypress fails to load the configuration file and throws the following error:
TypeError: webpackModule.init is not a function
at sourceNextWebpack (/Users/me/Library/Caches/Cypress/15.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/webpack-dev-server/dist/helpers/nextHandler.js:308:19)
at sourceNextWebpackDeps (/Users/me/Library/Caches/Cypress/15.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/webpack-dev-server/dist/helpers/nextHandler.js:268:21)
at nextHandler (/Users/me/Library/Caches/Cypress/15.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/webpack-dev-server/dist/helpers/nextHandler.js:18:74)
at async getPreset (/Users/me/Library/Caches/Cypress/15.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/webpack-dev-server/dist/devServer.js:60:20)
at async devServer.create (/Users/me/Library/Caches/Cypress/15.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/webpack-dev-server/dist/devServer.js:79:61)
at async /Users/me/Library/Caches/Cypress/15.5.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/webpack-dev-server/dist/devServer.js:22:24Desired behavior
Cypress should successfully load the configuration file and run the component tests without errors.
Test code to reproduce
https://github.com/KenTandrian/cypress-nextjs-16-webpack
Reproduction Steps:
- Create a Next.js project (version 16.0.0).
- Install Cypress (version 15.5.0) with component testing support.
- Configure Cypress to use the Next.js framework and webpack bundler in
cypress.config.ts. - Attempt to run component tests using the command
yarn cypress run --component.
Cypress Version
15.5.0
Debug Logs
N/A -- it fails before running the test.Other
The issue started occurring after upgrading to Next.js version 16. This suggests a potential incompatibility or breaking change introduced in Next.js 16.
I believe the error stems from the Cypress code still calling webpackModule.init here:
| webpackModule.init(webpack5) |
This function no longer exists in the newer node_modules/next/dist/compiled/webpack/webpack.js file in Next.js 16.
Juliencd, baniplus, thiagomini, zmays, chinmaykunkikar and 2 more
Metadata
Metadata
Assignees
Labels
No labels