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

[RFC] Remove @mui/material default theme and @mui/system, @pigment-css/react reexports #40594

Open
oliviertassinari opened this issue Jan 15, 2024 · 1 comment
Assignees
Labels
breaking change enhancement This is not a bug, nor a new feature performance RFC Request For Comments

Comments

@oliviertassinari
Copy link
Member

oliviertassinari commented Jan 15, 2024

Pros

The motivation is similar to #40590: isolation of purposes. What if we were forcing developers to import from @mui/system, and @mui/material directly, no longer reexporting anything from @mui/material. This is a strategic move to:

  1. Brand education. Better isolate the responsibilities, to educate developers that each of these 3 modules solves different problems. It forces people to use the right docs.

When you use Shadcn UI, Tailwind CSS is not reexported of it.

  1. Performance marketing. better isolate the bundle size, removing the perception of bloat.

This would for instance better communicate the real cost of adding new Material UI components. When you look at https://bundlephobia.com/package/@mui/[email protected] you see a huge bloat:

but the actual cost is much 90% lower, once you have all the shared dependencies. This can also look frightening from the IDE when using this popular VS Code extension: https://marketplace.visualstudio.com/items?itemName=wix.vscode-import-cost

  1. Customization This better supports the strategic direction of having @mui/material only about the CSS logic of the components (you can have it in npm or in your sources, your choice). For this to work, the source needs to be written in a way that everything exported from @mui/material can end-up in someone's codebase. For example, it would be insane to keep:

    function isHostComponent(element: React.ElementType) {
    in this location.

  2. Multi-theme support. These reexports made a big mess with Joy UI. We have a lot of duplication in the codebase, but it's wrong, we should have used MUI System properly to support multi-theme.

Neutral

CSS Variables support makes a theme provider required. For a long time not having the theme provider requirement was a differentiator of Material UI against https://github.com/react-toolbox/react-toolbox. React Toolbox was harder to configure, creating friction to adoption. Today, Tailwind CSS too doesn't have drop-in support for components, you have to configure it first.

@oliviertassinari oliviertassinari added performance status: waiting for maintainer These issues haven't been looked at yet by a maintainer enhancement This is not a bug, nor a new feature RFC Request For Comments breaking change v6.x labels Jan 15, 2024
@oliviertassinari

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change enhancement This is not a bug, nor a new feature performance RFC Request For Comments
Projects
None yet
Development

No branches or pull requests

3 participants