-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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
[styled] Specify emotion & styled-components as optional peer dependencies #22808
Merged
mnajdova
merged 10 commits into
mui:next
from
mnajdova:fix/specify-emotion-and-sc-as-optional
Oct 5, 2020
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c2d31cc
add emotion peer dependencies
mnajdova 5ae933f
fixed types & tests
mnajdova 18b0668
prettier
mnajdova f0ef95c
Merge branch 'next' of https://github.com/mui-org/material-ui into next
mnajdova c7bebb8
Merge branch 'next' of https://github.com/mui-org/material-ui into next
mnajdova 92b2d6e
Merge branch 'next' of https://github.com/mui-org/material-ui into next
mnajdova 13da531
Merge branch 'next' of https://github.com/mui-org/material-ui into next
mnajdova cf5d9a5
Merge branch 'next' of https://github.com/mui-org/material-ui into next
mnajdova 4729ff5
specify emotion & styled-components as optional peer dependencies
mnajdova d774066
Update packages/material-ui-styled-engine-sc/package.json
mnajdova File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we specify these as regular peer dependencies here and as optional peer dependencies only in the core? Same would apply for the
@material-ui/styled-engine-sc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving conversation from #22788 (review) here
@oliviertassinari @eps1lon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No objection, no strong point of view either:
Pros:
Cons:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go with optional everywhere for now and see how it will go then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're also part of the problem why "nobody" looks at these. It's pretty straight forward to fix them but many (especially library authors) just ignore them right from the start because "it works on my machine". Apart from hoisted peer dependencies I've never seen a peer dep warnings that's not an actual issue and just works with the exact same declared dependencies (which rarely happens because lib consumers don't pull in dev deps).
So peer dep warnings are important. It's ok to ignore them as an app dev but as a library author you actually ship problems to your users.
These are required peer deps as far as I can tell so they shouldn't be marked as optional. Hoisting them just isn't supported in yarn v1. A proper test to verify correctness of the tree would be installing with pnpm or yarn v2 (with and without PnP).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If developers have configured correctly
styled-engine-sc
in their bundler as alias, the warning are not meaningful. The question is then, should we try to fix these warnings, or should we consider that they should know that once that the alias is configured they no longer need emotion?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eps1lon Agree, I think that npm warnings should be avoided as much as possible.
We haven't that many great options, the one I cant think of outside the changes proposed (1.):
Happy to try 1. out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologizes I am a bit confused at this moment. What exactly is the plan? Should we add these as optional or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vote for the options in this order of preference: 1 > 3 > 4 > 2. @eps1lon what would you recommend?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can not stress this enough: This would not be fine. It causes bundle bundle bloat.
I'll need to think about this a bit more and will talk to some package manager folks how they would recommend we move forward. We probably should need to mark the styled-engine as peer not the underlying style library. That's not that big of an issue since we already have to install peers anyway. And with npm 7 that won't be an issue at all anyway. This PR is fine for now.