-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Upgrade to Emotion 11 #31476
Upgrade to Emotion 11 #31476
Conversation
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've noticed that Emotion cache requires providing a key, otherwise Storybook ends up being broken.
This is currently broken, the build will fail not being able to resolve
@emotion/styled-base
but I'm not sure why it's trying to resolve that anymore. What is still using@emotion/styled^10.0.0
?
Seems like @storybook/theming
is still using @emotion/styled^10.0.27
: https://github.com/WordPress/gutenberg/blob/upgrade/emotion-11/package-lock.json#L10617
@@ -1,7 +1,7 @@ | |||
/** | |||
* External dependencies | |||
*/ | |||
import { CacheProvider } from '@emotion/core'; | |||
import { CacheProvider } from '@emotion/react'; |
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.
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.
But StyleProvider
could be used any number of places. I think we'd probably want an instance id?
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.
Yeah, but at the same time do we really need multiple caches?
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.
Yes 🙂 We need one per iframe for iframes to receive styling.
@sarayourfriend, thank you for starting this PR. I assume that we plan to use emotion outside of
This gives us room to bridge future breaking changes, but it also ensures that in the WordPress context those libraries are bundled only into one chunk/module. Aside: It looks like Storybook is becoming a bottleneck for keeping tools and libraries up to date:
|
Do you mean just re-exporting from a particular place? Would that be a new package or just a re-export from |
From |
Should we do that as part of this PR? |
It's all up to you. If we had that earlier, this PR would be a few import statements to update in a single file rather than in 50 😄 |
I'm personally not certain at all that we'd ever want to introduce emotion to other packages than |
I think we don't need a proxy necessarily... it's one more thing in the eco-system for JS devs to keep track of when they could just normally import from the regular places (we already have to learn about If we're not going to use it outside of Maybe it's something to revisit if we begin to use it outside of Additionally, PRs like this should be one in a thousand. Presumably they're not going to change their package names all over again. |
I'm not sure how to proceed on this PR. Can @youknowriad or @gziolo give me some guidance? And maybe also rope in someone who knows more about build systems than I do to help figure out how to get |
269f8e3
to
736f0d9
Compare
@youknowriad why would the PHP tests fail for this PR? Any ideas? |
@sarayourfriend can't think of anything based on the list of changes. Did you try rebasing the PR? |
fcc43f4
to
77926be
Compare
6279c92
to
4e05de2
Compare
I'm unable to reproduce the type error locally 🤔 Adding It seems like that the root cause of the failures at the moment. Once we fix that we should be able to move forward with the rest of the PR. |
I've been unable to reproduce the build issues either. Could there be some dependency caching that's causing problems? |
Looking at the logs I think I know why I wasn't able to reproduce the issue:
This action is:
I was only testing the first two steps. Likely there are some cache/node_modules leftovers that are not clean in the second |
I can reproduce this locally. This is what is going on:
I'm not sure what is the root problem where:
Possible solutions:
For the record, I'm using
Running |
I can't find it documented anywhere, but it does not remove nested node_modules. |
a0bbaa4
to
bad04b7
Compare
Oh shoot @sirreal I'm so sorry, in rebasing I completely over-wrote your changes 😞 I'll try to fix this ASAP. |
Actually never mind, I'm not sure how to replicate your changes. I'm so so sorry 😞 Maybe @scinos since you're already looking at this you can help fix my mistake? Again, so sorry y'all! |
I don't have permissions :( This is what I was trying to do to restore the branch:
|
a0bbaa4
to
66cbc2b
Compare
Thanks @scinos that fixed it! |
You can also try this approach from https://cpojer.net/posts/dependency-managers-dont-manage-your-dependencies:
You can even go one step further and install all new dependencies in the root |
FWIW, I think the problem here is the action. We have shown that the pattern Unrelated on how we finally go with the emotion update, I'd suggest to get rid of any process (that includes the action) that assumes that running |
That action allows you to specify an alternative Can we use that to maintain the current build pipelines but get around this issue (probably in a separate PR)? |
66cbc2b
to
d0d9805
Compare
@scinos I'm going to open this in a fork so you can have access to contribute if that works for you? |
Closing in favor of #32216 |
Description
Upgrades to Emotion 11, includes a workaround for Storybook: storybookjs/storybook#13300 (comment)
This is currently broken, the build will fail not being able to resolve
@emotion/styled-base
but I'm not sure why it's trying to resolve that anymore. What is still using@emotion/styled^10.0.0
?How has this been tested?
Run Gutenberg with this PR and verify that Emotion components are still working as expected. Check that the
StyleProvider
is working as expected for iframes in FSE.Also run storybook
npm run storybook:dev
and ensure that all Emotion components are working as expected.Types of changes
Dependency upgrade. Non-breaking change.
Checklist:
*.native.js
files for terms that need renaming or removal).