synpress: Module parse failed: 'import' and 'export' may appear only with 'sourceType: module' (1:0)
🔎 Have you searched existing issues to avoid duplicates?
- I have made sure that my issue is not a duplicate.
🧪 Have you tested your code using latest version of Synpress?
- I have made sure that my issue still exists on latest version of Synpress.
💡 Are you able to provide enough information to be able to reproduce your issue locally?
- I can provide enough details to reproduce my issue on local environment.
Synpress version
3.7.2-beta.5
Node.js version
18.17
Operating system
Ventura 13
Run mode
Synpress (standalone)
CI platform (if applicable)
No response
Are you running your tests inside docker? (if applicable)
- This issue could be related to docker.
What happened?
after adding Cypress and Synpress to Next.js project and importing "import ‘@synthetixio/synpress/support/index’ " into support.js cypress showing error when running tests
`Error: Webpack Compilation Error
Module parse failed: 'import' and 'export' may appear only with 'sourceType: module' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See
https://webpack.js.org/concepts#loaders
> import './commands';
| import { configure } from '@testing-library/cypress';
|
at Watching.handle [as handler] (/Users/mostafa/Library/Caches/Cypress/12.17.4/Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/webpack-preprocessor/dist/index.js:212:23)`
It obviously yelling because it needs loaders for the import and export that is being used inside “@synthetixio/synpress/support/index” file that we imported in support.js according to the installation section in Synpress repo
What is your expected behavior?
No response
How to reproduce the bug.
To reproduce the bug follow the installation process in a fresh Next.js 13 project
Relevant log output
No response
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 16 (5 by maintainers)
I’ve done some digging, and this error occurs due to an issue with Cypress
v12.17.4
. If you downgrade to versionv12.17.3
or lower in your projects, it should go away.I’ll push a new Synpress release with the fix tomorrow 🫡
sounds good… thanks @duckception … appreciate your prompt response