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

[docs] Add emotion dependencies in codesandbox examples #22736

Merged
merged 3 commits into from
Sep 26, 2020

Conversation

mnajdova
Copy link
Member

@mui-pr-bot
Copy link

mui-pr-bot commented Sep 25, 2020

No bundle size changes comparing 2596203...18b0668

Generated by 🚫 dangerJS against 18b0668

@eps1lon
Copy link
Member

eps1lon commented Sep 25, 2020

@mnajdova Tests are failing (which is intended).

@eps1lon eps1lon added the docs Improvements or additions to the documentation label Sep 25, 2020
@mnajdova
Copy link
Member Author

@eps1lon fixed :)

@@ -77,6 +77,8 @@ function includePeerDependencies(deps, versions) {
Object.assign(deps, {
'react-dom': versions['react-dom'],
react: versions.react,
'@emotion/core': versions['@emotion/core'],
'@emotion/styled': versions['@emotion/styled'],
Copy link
Member

@oliviertassinari oliviertassinari Sep 25, 2020

Choose a reason for hiding this comment

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

I would like to follow-up on #22435 (comment).

@Andarist Does @emotion/styled have any singleton? Would it be safe if we make it a dependency of @material-ui/style-engine? We don't depend on the theme provider of emotion/sc, we use our own. My hope is that we can only retain @emotion/core as a peer dependency.

Copy link
Contributor

Choose a reason for hiding this comment

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

Styled pkg doesnt create any singletones - it only consumes them.

Copy link
Member

Choose a reason for hiding this comment

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

Even if it doesn't have a singleton we should always be aware of potential duplicate bundling. Style engines shouldn't be direct dependencies if we want users to customize it. Otherwise they might use a different version than we do.

Copy link
Member

@oliviertassinari oliviertassinari Sep 26, 2020

Choose a reason for hiding this comment

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

Otherwise they might use a different version than we do.

True, version can be different. Would it lead to issues?

Maybe we should be greedy like we were with @material-ui/style-engine (using a dependency over a peer dependency because simpler but makes using styled-components harder)? We could start with the approach that can yield the simplest installation steps (@emotion/styled as a dependency) and based on the pain we hear from developers change the tradeoff.

Copy link
Member

Choose a reason for hiding this comment

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

Another element, it seems that in the demos, we will do:

import styled from '@material-ui/core/styled';

or something similar so we can benefit from auto-switch between em/sc, the theme provider of MUI, and the default theme's values.

Copy link
Member

Choose a reason for hiding this comment

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

True, version can be different. Would it lead to issues?

It would lead to multiple versions in the bundle:

Even if it doesn't have a singleton we should always be aware of potential duplicate bundling

@oliviertassinari
Copy link
Member

I'm merging so we can include it in the incoming release:

Capture d’écran 2020-09-26 à 15 10 14

@oliviertassinari oliviertassinari merged commit 488fd2c into mui:next Sep 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants