fix(Webpack): Ensure to load CSS in correct order. #12484
Merged
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.
Description
Currently, we're not loading CSS in the correct order in Studio. This may have gone unnoticed because the React package from the design system has been handling it for us. However, there's an upcoming release that will change this, requiring us to take control of the CSS loading order ourselves. I've made the necessary changes in this pull request. It's fine to merge this PR before we update the design system.
Why this posed an issue:
Failing to prioritize the inclusion of CSS from the design system first puts us at risk of needing to resort to using !important to override CSS. The last-loaded CSS takes precedence. If our custom CSS is loaded beforehand, it gets overwritten by the subsequently loaded design system CSS.
Images that shows the difference:
The image below illustrates that the design system (first referenced in Index.tsx) is the initial CSS included within the style tag, as anticipated.
Before these changes, we had the wrong order:
Related Issue(s)
Verification