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
Move cropper CSS import from main bundle to upload plugin #15235
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.
neat!
cropped assets in upload/CM and upload/ML without issues 👌
Codecov ReportBase: 60.52% // Head: 60.52% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #15235 +/- ##
==========================================
- Coverage 60.52% 60.52% -0.01%
==========================================
Files 1352 1352
Lines 33172 33170 -2
Branches 6334 6334
==========================================
- Hits 20078 20076 -2
Misses 11263 11263
Partials 1831 1831
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@@ -1,11 +1,5 @@ | |||
import { createGlobalStyle } from 'styled-components'; | |||
|
|||
const loadCss = async () => { | |||
await import(/* webpackChunkName: "cropper-css" */ 'cropperjs/dist/cropper.css'); |
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 wonder if moving it to the upload plugin will cause some flickering since it will be reimported each time the ML is mounted?
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 we used a dynamic import, it would create a separate chunk which then could load late and lead to flickering - I agree, but we don't do that. A sync import will be bundled together with the PreviewBox
component, and as soon as it has loaded, the styles will be there immediately. It increases the size of the chunk a bit, but since it is pretty much isolated, I don't see a big problem in this. Also: the Modal containing the PreviewBox
could be moved into its own webpack chunk, if we would want to do this.
What does it do?
Moves the cropperjs CSS import from the main bundle into the upload plugin.
Why is it needed?
How to test it?
Related issue(s)/PR(s)