Cross Origin Error (Vite 3.0.0-beta.10)
See original GitHub issueDescribe the bug
Hi,
We use Vite for development in Cypress, and as part of the Component Testing product. We build @cypress/vite-dev-server
to facilitate Component Testing with Vite as a dev server.
I’m excited for Vite 3, and tried it out. I’m running into this error, that I didn’t previously see in Vite 2:
Uncaught DOMException: Blocked a frame with origin "http://localhost:4455" from accessing a cross-origin frame.
at http://localhost:4455/__cypress/iframes//tmp/cy-projects/vite-3-react/src/App.cy.jsx:15:49
I’m not expecting the Vite team to fix this for me, more looking for info on
- What change in Vite 3 might be leading to this?
- How I can contribute a fix
I included a reproduction, but it’s not exactly minimal, since it needs our dev-server and surrounding code to reproduce.
I can look to make a more minimal one if needed, but if someone more familiar with Vite’s code could suggest what might be leading to this problem, I can either patch it and/or work around it myself.
I’m guessing this isn’t a straight up bug, but a side effect or some internals we are relying on. Hoping to figure something out before we move Vite to 3.0.0.
Reproduction
https://github.com/cypress-io/cypress/pull/22748
System Info
1. Clone branch from above repo
2. `yarn`
3. `cd npm/vite-dev-server`
4. `yarn cypress:run --spec cypress/e2e/react.cy.ts --headed`
Only Vite 3 fails - you can see the error in the console.
Used Package Manager
yarn
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created a year ago
- Comments:10 (6 by maintainers)
Top GitHub Comments
It’s landed in
alpha.12
😂 I now have no idea why I thoughtalpha.11
was the buggy version… Sorry for the confusion.The fix that actually worked is in this file:
npm/vite-dev-server/src/plugins/cypress.ts
:The change in Vite 3 causing this issue is: https://github.com/vitejs/vite/pull/6901