New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Minified React error #321; #586
Comments
error details:
|
Hi, I am also facing this issue when using the same remote app in two different micro-frontends kept within a single spa root app. This occurs when I switch between these two apps, The first app loads perfectly but when I navigate to other app i get this same error, when switched back to first app, that app breaks as well. Were you able to figure out anything? |
Hello, I looked at the vite-plugin-federation source code and found that when switching to the next application, the React instance of the previous application is still used.
import externalGlobals from "rollup-plugin-external-globals"
build: {
rollupOptions: {
external: ['react', 'react-dom'],
plugins: [
externalGlobals({
'react': 'React',
'react-dom': 'ReactDOM'
}),
]
}
}
import React from 'react'
import ReactDOM from 'react-dom'
Object.defineProperty(window, 'React', {
value: React,
writable: false,
configurable: false,
})
Object.defineProperty(window, 'ReactDOM', {
value: ReactDOM,
writable: false,
configurable: false,
}) |
How should I use the |
Externalize react and react-dom from each and every micro frontends, and create a global scoped variable from the portal app/root/container You can define the global variable in the entry file of your root app/container/portal app |
I tried to use remote components in two sub-projects based on qiankun, and this error was reported when switching sub-applications. Is there any solution?
bug:
This is my configuration:
host1:
host1:
remote:
The text was updated successfully, but these errors were encountered: