cypress
cypress copied to clipboard
Fix/laravel module support
After the default install of Laravel package.json switched to modules in v10.2.6, a fresh install of this package is broken.
ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/Users/chrisarter/Documents/projects/CypressExample/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
Versions:
- Laravel v10.10
- Cypress v12.17.4
- Node v20
- laracasts/cypress 3.0
Changes
- Change stubs to use ES modules to support new Laravel installs.
I also ran into this issue, I think it would be smart to create a flag for the cypress:boilerplate command and that it will then just change the extension of the config file to .cjs.
Or make this the new default and add a flag when using an older Cypress implementation.
Testst the PR and can confirm it is working. It's not working without (ReferenceError: require is not defined)