Cypress throws an error when using .invoke() in a SystemJS vite (Rollup) application #31419
Replies: 1 comment
-
the error also happens when i try to call .then() on an element |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
after migrating our app from create-react-app (webpack) to Vite (Rollup), where both builds externalize "react" and "react-dom", because the app is part of a single-SPA micro frontend, which loads react and react-dom, I start to run into problems with the Cypress tests which call .invoke(). All other tests are passing.
This is the error stack trace:
the error only occurs during the test runs and is not reproducible manually.
to give more context, this is the start of the bundle, which is referenced in the stack trace myOrg-masterdata.js:1:244:
Bn
(normally a WeakMap) is the thing that is not defined in the SystemJS bundle.I tried waiting a couple of seconds in the test, but this didnt solve it.
What solved it, was to NOT exclude react from the bundle. But this would mean all micro frontends have a complete react package in their production bundle and with multiple micro frontend on a page, it would mean multiple times parsing the react code and having multiple react instances. This cant be the solution, only because the error happens in cypress but not when surfing the app.
Also since the other tests pass, mean react was generally loaded successfully and the app is also working inside cypress.
At this point Im clueless, why the error happen or how to solve it properly.
I would be happy for any hint.
cheers
Beta Was this translation helpful? Give feedback.
All reactions