Skip to content

Conversation

@christopherarter
Copy link

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 christopherarter marked this pull request as draft August 23, 2023 12:49
@GertjanRoke
Copy link

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.

@philharmonie
Copy link

philharmonie commented Oct 3, 2023

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

@AndrewSavetchuk
Copy link

Thanks @christopherarter, I used the code from this PR to fix the same issue on my environment.

@mariomeyer
Copy link

Thx @christopherarter. Also used the changes in the PR to fix my environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants