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

shared configuration not fully reflected in mf-manifest.json (enhanced federation with Rsbuild) #3101

Open
5 tasks done
foxylion opened this issue Oct 21, 2024 · 2 comments
Open
5 tasks done

Comments

@foxylion
Copy link

foxylion commented Oct 21, 2024

Describe the bug

I tried configuring the shared section of the module federation configuration, but some changes are not being reflected in the mf-manifest.json file.

Steps to Reproduce:

  • Clone the repository from here.
  • Start the project located at rsbuild/module-federation-enhanced/consumer, the configuration includes the following:
     shared: {
       react: { singleton: false, requiredVersion: '^18.0.0' },
       'react-dom': { singleton: false, requiredVersion: '^18.0.0' },
     }
  • Check the mf-manifest.json file at http://localhost:2000/mf-manifest.json, the shared block in the manifest contains the following:
     "shared": [
       {
         "id": "federation_consumer:react-dom",
         "name": "react-dom",
         "version": "18.2.0",
         "singleton": true,
         "requiredVersion": "^18.2.0",
         "assets": {
           "js": {
             "async": [
               "static/js/async/vendors-node_modules_pnpm_react_18_2_0_node_modules_react_index_js.js"
             ],
             "sync": [
               "static/js/async/vendors-node_modules_pnpm_react-dom_18_2_0_react_18_2_0_node_modules_react-dom_index_js.js"
             ]
           },
           "css": {
             "async": [],
             "sync": []
           }
         }
       },
       {
         "id": "federation_consumer:react",
         "name": "react",
         "version": "18.2.0",
         "singleton": true,
         "requiredVersion": "^18.2.0",
         "assets": {
           "js": {
             "async": [],
             "sync": [
               "static/js/async/vendors-node_modules_pnpm_react_18_2_0_node_modules_react_index_js.js"
             ]
           },
           "css": {
             "async": [],
             "sync": []
           }
         }
       }
     ]

The mf-manifest.json file reflects the singleton setting as true, despite my configuration setting it to false. Additionally, the requiredVersion specified in my configuration (^18.0.0) seems to be overridden by default values.

Reproduction

https://github.com/foxylion/rspack-examples/tree/repro/share-config-not-in-mf-manifest-json (Diff)

Used Package Manager

pnpm

System Info

System:
  OS: Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
  CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
  Memory: 4.60 GB / 31.02 GB
  Container: Yes
  Shell: 5.9 - /bin/zsh
Binaries:
  Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node
  npm: 10.8.2 - ~/.nvm/versions/node/v20.18.0/bin/npm
  pnpm: 9.12.1 - ~/.local/share/pnpm/pnpm
Browsers:
  Chrome: 129.0.6668.100

Validations

@foxylion
Copy link
Author

@ScriptedAlchemy do you have any thoughts on that? Is this possibly another Rsbuild related problem?

@ScriptedAlchemy
Copy link
Member

@2heal1 can you cake a look at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants