cypress icon indicating copy to clipboard operation
cypress copied to clipboard

Fix/laravel module support

Open christopherarter opened this issue 2 years ago • 4 comments

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.

christopherarter avatar Aug 22 '23 15:08 christopherarter

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.

GertjanRoke avatar Sep 08 '23 09:09 GertjanRoke

Testst the PR and can confirm it is working. It's not working without (ReferenceError: require is not defined)

philharmonie avatar Oct 03 '23 11:10 philharmonie