You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context: Vite + @module-federation/vite host app running in dev mode, pulling a remote platform app that is served as a production build. Both share react/[email protected] as singletons.
Symptom: Loading the remote in the host triggers TypeError: Cannot read properties of undefined (reading 'push') inside react-dom_client.js. Dev React expects ReactSharedInternals.actQueue, but the prod bundle (remote) lacks it. The console also prints “The current testing environment is not configured to support act(...)”.
Repro Steps:
Start host with vite dev in an environment where the host shares React with a production-built remote (remoteEntry.js).
Navigate to a route that lazy-loads the remote (React.lazy(() => import('platform/App'))).
Observe the runtime error before any UI renders.
Workaround Implemented: In main.tsx, during dev builds we check __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; if actQueue is missing we define it (reactInternals.actQueue = null). A feature flag (VITE_ENABLE_REACT_ACT_PATCH) scopes this to local dev only.
if (
import.meta.env.DEV &&
import.meta.env.VITE_ENABLE_REACT_ACT_PATCH === 'true'
) {
console.log('patching react act')
const reactInternals = (
React as unknown as {
__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE?: {
actQueue?: unknown
}
}
).__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE
if (reactInternals && !('actQueue' in reactInternals)) {
// Remote production bundles share a React build without actQueue; define it to keep dev scheduling intact.
reactInternals.actQueue = null
}
}
Other Considered Options: Run the remote as a dev build, proxy the remote through a dev server, or force both host and remote to share the same production React build (losing dev diagnostics). None are ideal for running the host against a production remote during local dev.
Clarification Needed: Is there an official Module Federation recommendation for mixing dev/prod React builds? Is there a safer pattern than patching internals, or should MF prevent sharing when builds mismatch?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Context: Vite + @module-federation/vite host app running in dev mode, pulling a remote platform app that is served as a production build. Both share react/[email protected] as singletons.
Symptom: Loading the remote in the host triggers
TypeError: Cannot read properties of undefined (reading 'push')
inside react-dom_client.js. Dev React expects ReactSharedInternals.actQueue, but the prod bundle (remote) lacks it. The console also prints “The current testing environment is not configured to support act(...)”.Repro Steps:
__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
if actQueue is missing we define it (reactInternals.actQueue = null
). A feature flag (VITE_ENABLE_REACT_ACT_PATCH
) scopes this to local dev only.Other Considered Options: Run the remote as a dev build, proxy the remote through a dev server, or force both host and remote to share the same production React build (losing dev diagnostics). None are ideal for running the host against a production remote during local dev.
Clarification Needed: Is there an official Module Federation recommendation for mixing dev/prod React builds? Is there a safer pattern than patching internals, or should MF prevent sharing when builds mismatch?
Beta Was this translation helpful? Give feedback.
All reactions