Material-ui: V5 - @emotion peer dependency

Created on 5 Nov 2020  路  3Comments  路  Source: mui-org/material-ui

  • [x] The issue is present in the latest release.
  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 馃槸

After a clean installation of @next (alpha 14) with CRA, @emotion/core and @emotion/styled are not in scope for the project. Importing a component from from @material-ui reveals that the peer dependencies are not installed. @material-ui/styled-engine/index.js relies on emotion.

Expected Behavior 馃

Using a component from Material-UI should work without having to install additional peer dependencies.

Steps to Reproduce 馃暪

https://codesandbox.io/s/relaxed-dust-99u5t?file=/src/App.js

Context 馃敠

I understand this may be intentional as I haven't followed too closely to the discussion of what will be the default styling solution in V5. If it is the default, it should probably be moved from a peerDependency to dependency. Otherwise this may just be a temporary inconvenience until it is determined how to select what styling library you would like to use under the hood.

Your Environment 馃寧

| Tech | Version |
| ----------- | ------- |
| Material-UI | v5.0.0-alpha14 |
| React | v17.0.0 |

discussion

Most helpful comment

@levigunz This is an interesting topic. You can find a thread about this very topic at https://github.com/mui-org/material-ui/pull/22435#discussion_r490782223. We are still not 馃挴 sure that it's the best approach. cc @eps1lon @mnajdova.

All 3 comments

Opened a PR resolving this, but there may be a wider discussion about what _should_ be the default when Material-UI is installed in a project that has no other style library already in use.

I think most will agree that it should work, or at the very least the documentation should be updated to reflect that there are additional steps to usage (installing emotion in this case)

@levigunz This is an interesting topic. You can find a thread about this very topic at https://github.com/mui-org/material-ui/pull/22435#discussion_r490782223. We are still not 馃挴 sure that it's the best approach. cc @eps1lon @mnajdova.

@oliviertassinari @mnajdova can we add this discussion to the #22342 initial comment? Make it a little more visible that it is an open question rather than a specific issue? Hopefully it will be a little easier for others to find and we can close this thread.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mattmiddlesworth picture mattmiddlesworth  路  3Comments

ryanflorence picture ryanflorence  路  3Comments

sys13 picture sys13  路  3Comments

iamzhouyi picture iamzhouyi  路  3Comments

FranBran picture FranBran  路  3Comments