originjs/vite-plugin-federation

[MaterialUI] Cannot read properties of null (reading 'useContext')

nahimr opened this issue · 4 comments

When calling useTheme hook from @mui/material, this throws an error.

image

Shared dependencies

On host side :

image

On remote side :

image

Versions

  • vite-plugin-federation: 1.3.5
  • vite: 5.2.8
  • @emotion/react: 11.11.4
  • @emotion/styled: 11.11.5
  • @mui/material: 5.15.15

Steps to reproduce

What is Expected?

It's expected to use correctly the hook useContext that its called by useTheme.

What is actually happening?

It's missing shared useContext reference of React.

Related to #595.

Try adding to package.json following:
"resolutions": {
"react": "18.3.1"
},

Replace react version with yours

Hello nahimr, were you able to resolve this error?