This section is a collection of common issues related to the implementation of Module Federation
in general(not specific error code).
The main goal is to provide additional context and solution paths for beginners not familiar with the fundamental ways of how Module Federation
is working at its core.
Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
You might have mismatching versions of React and the renderer (such as React DOM)
You might be breaking the Rules of Hooks
You might have more than one copy of React in the same app
Uncaught TypeError: Cannot read properties on null (reading useState
)
This error is a React multi-instance problem, which usually occurs when react does not reuse the same instance.
This problem can be avoided by setting shared
and setting singleton: true
singleton mode.
Unable to compile federated types, Error: compile TS failed, the original command is 'npx tsc --project file-path.json'.
Error: ENOENT: no such file or directory, open 'project-path/rspack_hmr/application-name/dist/@mf-types.zip'
npx tsc --project file-path.json
according to the error message to solve all type problems encountered.ModuleFederationPlugin
config field exposes
: