-
Notifications
You must be signed in to change notification settings - Fork 33
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
fix: ensure webpack.dev.config.js includes quietDeps: true, applies injected <link> styles once loaded, example app updates to show ParagonWebpackPlugin output #584
Conversation
a06cb0f
to
db142b1
Compare
@@ -15,8 +15,9 @@ | |||
"author": "", | |||
"license": "ISC", | |||
"dependencies": { | |||
"react": "^16.14.0", | |||
"react-dom": "^16.14.0" | |||
"@openedx/paragon": "22.7.0", |
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.
[inform] Now installs @openedx/paragon
in example app, which now includes a ParagonPreview
component to render the output of the generated PARAGON_THEME
global variable. It also includes a basic component preview of Button
, which will be useful when using the example app for any of brand package overrides with the ParagonWebpackPlugin
(e.g., to sure it's applying correctly).
@@ -38,6 +39,7 @@ export default function App() { | |||
<p>env.config.js integer test: {Number.isInteger(config.INTEGER_VALUE) ? 'It was an integer. Great.' : 'It was not an integer! Why not? '}</p> | |||
<h2>Right-to-left language handling tests</h2> | |||
<p className="text-align-right">I'm aligned right, but left in RTL.</p> | |||
<ParagonPreview /> |
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.
[inform] This is carried over from my original PR for ParagonWebpackPlugin
.
@@ -74,6 +74,7 @@ function insertStylesheetsIntoDocument({ | |||
rel="preload" | |||
as="style" | |||
href="${url}" | |||
onload="this.rel='stylesheet';" |
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.
[inform] Ensures the pre-loaded stylesheet is applied once its successfully loaded. E.g., it no longer relies on the corresponding frontend-platform PR to apply the injected <link>
styles, ensuring they're applied as early as possible in the initial page load.
Edit: frontend-platform is more responsible for handling when:
- there's an initial attempt at loading CDN urls fails from frontend-build, frontend-platform will retry, and then fallback to the locally installed version.
- the
PARAGON_THEME_URLS
config changes at runtime (e.g., via MFE runtime config API or a dynamic value withenv.config
).
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.
LGTM! Since this is all in 1 commit would you mind updating the commit message to mention all the changes (or just changing the PR title and we can squash)?
🎉 This PR is included in version 14.1.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 15.0.0-alpha.16 🎉 The release is available on: Your semantic-release bot 📦🚀 |
CHANGELOG
Fix
quietDeps: true
regression during local devAs part of #546, some of the styles-related Webpack config in
webpack.dev.config.js
were refactored to a helper functiongetStyleUseConfig
. As part of this refactor, thequietDeps
option passed insassOptions
was lost.Without
quietDeps: true
, Webpack will throw a (loud) warning in the browser/console given some usage of deprecated Sass syntax in some/all MFEs when runningnpm start
to run the app.This PR ensures
quietDeps: true
is added back tosassOptions
to remove deprecation errors surfaced by Webpack.Applies injected
<link>
stylesonload
Currently, frontend-build injects
<link>
elements withrel="preload" as="style"
, but does not actually apply the styles itself.This PR adds an
onload
handler on the injected<link>
elements to ensure the stylesheets are applied as early as possible, e.g. without relying on frontend-platform's handling ofPARAGON_THEME_URLS
.In short, frontend-build is primarily be responsible for applying Paragon/brand styles from configuration on initial page load whereas frontend-platform is responsible to handling any runtime configuration changes of the configuration (e.g., as this could be used with the MFE runtime configuration API, or if
env.config.js
is dynamic).Example MFE app
@use '@openedx/paragon/scss/core/core';
)v23
is released.ParagonPreview
in the example app to more easily QA changes inParagonWebpackPlugin
, carried over from my original PR.With Paragon v22
With Paragon / brand package (
@edx/elm-theme
, github) v23 (alpha
)