Skip to content
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

[Bug]: Shared context doesn't seem to work with runtime module federation[Bug]: #7066

Open
AdamJSoftware opened this issue Jul 7, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@AdamJSoftware
Copy link

System Info

Need to install the following packages:
envinfo@7.13.0
Ok to proceed? (y) y

System:
OS: Linux 6.1 Manjaro Linux
CPU: (12) x64 Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz
Memory: 13.32 GB / 30.96 GB
Container: Yes
Shell: 3.7.1 - /usr/bin/fish
Binaries:
Node: 18.19.0 - /run/user/1000/fnm_multishells/305667_1720381529332/bin/node
Yarn: 1.22.22 - /run/user/1000/fnm_multishells/305667_1720381529332/bin/yarn
npm: 10.2.3 - /run/user/1000/fnm_multishells/305667_1720381529332/bin/npm
npmPackages:
@rspack/cli: ^1.0.0-alpha.0 => 1.0.0-alpha.0

Details

I am trying to share mantine with module federation. However, mantine requires a context to be created. Even though I have specified @mantine/core as a singleton in both the remote and shell. It still says that the context has not been initialized and the app crashes.

Reproduce link

https://github.com/AdamJSoftware/rspack-module-federation-bug

Reproduce Steps

  1. cd remote
  2. yarn install
  3. yarn dev
  4. cd shell
  5. yarn install
  6. yarn dev
  7. Navigate to http://localhost:3000 and you will see
react.development.js:1618 Uncaught TypeError: Cannot read properties of null (reading 'useContext')
    at useContext (react.development.js:1618:1)
    at useMantineTheme (MantineThemeProvider.mjs:10:1)
    at useProps (use-props.mjs:9:1)
    at Text.mjs:46:1
    at renderWithHooks (react-dom.development.js:15486:1)
    at updateForwardRef (react-dom.development.js:19245:1)
    at beginWork (react-dom.development.js:21675:1)
    at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1)
    at invokeGuardedCallback (react-dom.development.js:4277:1)
@AdamJSoftware AdamJSoftware added bug Something isn't working pending triage The issue/PR is currently untouched. labels Jul 7, 2024
@AdamJSoftware
Copy link
Author

Similar issue is happening here: vercel/next.js#64887

Could this be an issue with the module federation spec itself?

@jerrykingxyz jerrykingxyz removed the pending triage The issue/PR is currently untouched. label Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants