mui / mui/material-ui

Lot's of Warnings when using Webpack Module Federation

Open
#29,983 11 comments 2 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

internal scope: all components
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Duplicates
  • I have searched the existing issues
Latest version
  • I have tested the latest version
Current behavior 😯

In our project, we're using Webpack Module Federation with the following share:

    new ModuleFederationPlugin({

        shared: {
            ...deps,

            "@mui/private-theming": {singleton: true},
            "@mui/material/styles": {singleton: true},
            "@mui/styles": {singleton: true},

            "react": {singleton: true},
            "react-dom": {singleton: true},

When building our project we've a lot of warnings like the following:

WARNING in shared module @mui/material/styles
No required version specified and unable to automatically determine one. Unable to find required version for "@mui/material" in description file (/home/mpo/icCube/gh/icCubeReportingMF/ic3-reporting/node_modules/@mui/lab/CalendarPicker/package.json). It need to be in dependencies, devDependencies or peerDependencies.

It seems the CalendarPicker/package.json file is missing the following:

  "peerDependencies": {
    "@mui/material": "^5.0.0"
  }

With this peerDependencies the warning disappear. There's a lot as well with 'react' dependency missing..

Does anybody experience the same issue?
Am I missing something with my setup?

If not would it be possible to update the package.json in the MUI project?

Let me know if you need more info.

Expected behavior 🤔

No such warnings.

Steps to reproduce 🕹

Steps:

  1. Build a project with Webpack Module Federation as shown in the description of this issue.
Context 🔦

No response

Your environment 🌎
`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.