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

[Demo] Fix UI glitches due to multiple conflicting MUI packages #10464

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions examples/demo/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ export default defineConfig(async () => {
// find: 'scheduler/tracing',
// replacement: 'scheduler/tracing-profiling',
// },
// The 2 next aliases are needed to avoid having multiple MUI instances
{
find: '@mui/material',
replacement: path.resolve(
__dirname,
'node_modules/@mui/material'
),
},
{
find: '@mui/icons-material',
replacement: path.resolve(
__dirname,
'node_modules/@mui/icons-material'
),
},
// we need to manually follow the symlinks for local packages to allow deep HMR
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about the core MUI packages, which are indirect dependencies ? And how about other major dependencies overridden in the demo package.json (react and react-router)?

Copy link
Collaborator Author

@djhi djhi Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The core MUI packages are resolved from the MUI packages that require them. In our case, the packages from the demo node_modules. I haven't seen multiple react-router packages loaded (neither in vite, nor in the node_modules)

...Object.keys(aliases).map(packageName => ({
find: packageName,
Expand Down
Loading