mammadataei / cypress-vite

Run Cypress specs using Vite
MIT License
87 stars 11 forks source link

TypeError: (0 , cypress_vite_1.default) is not a function #13

Closed StepanMynarik closed 1 year ago

StepanMynarik commented 2 years ago

Hi,

Just installed 1.2.1 in my project. I'm getting the following error when trying to run 'npx cypress run --e2e'

File: cypress.config.ts
---
The error was thrown while executing your e2e.setupNodeEvents() function:
TypeError: (0 , cypress_vite_1.default) is not a function

Any idea whats wrong?

mammadataei commented 2 years ago

Hi @StepanMynarik, I think this is related to typescript configuration. Try adding "esModuleInterop": true, to your tsconfig compilerOptions.

StepanMynarik commented 2 years ago

Didn't help unfortunately :( I also tried importing like so import * as vitePreprocessor from "cypress-vite"; but to no avail.

emilte commented 2 years ago

I have the same issue

emilte commented 2 years ago

Hi @StepanMynarik, I think this is related to typescript configuration. Try adding "esModuleInterop": true, to your tsconfig compilerOptions.

Nvm, this seems to have solved it.

mammadataei commented 2 years ago

Didn't help unfortunately :( I also tried importing like so import * as vitePreprocessor from "cypress-vite"; but to no avail.

Can you share your typescript, vite, and cypress configurations?!

Robperkstar commented 1 year ago

Hi @StepanMynarik

Not sure if this will help you but I was getting this error along with the error:

Missing baseUrl in compilerOptions. tsconfig-paths will be skipped

So I added a baseUrl field to my tsconfig file compilerOptions as: "baseUrl": "./" along with "esModuleInterop": true, and this fixed the issue.

nb. I used "./" because my cypress.config.ts was on the same folder level as tsconfig.json.

github-actions[bot] commented 1 year ago

This issue is automatically marked as stale because it has been open for 30 days with no activity. Remove the stale label or leave a comment, or it will be closed in 14 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 14 days with no activity. Please feel free to open a new issue if you have any further questions.