-
Notifications
You must be signed in to change notification settings - Fork 611
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
Bump PatternFly to latest #1546
Bump PatternFly to latest #1546
Conversation
@@ -56,7 +56,6 @@ const config: webpack.Configuration = { | |||
}, | |||
{ | |||
test: /\.s?css$/, | |||
exclude: /node_modules/, |
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.
@priley86 I know you needed this in your tables PR... What impact does this have on our builds?
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.
this is required due to react-core change in import methodology. CSS will be loaded directly from node_modules/@patternfly
from our JS requires.
I used the quick and easy method in the tables PR, but we should probably be more selective so that directories unexpected are not scanned for CSS. Looks we can do something like:
{
test: /\.s?css$/,
exclude: /node_modules\/(?!(@patternfly)\/).*/,
}
or
{
test: /\.s?css$/,
exclude: function(modulePath) {
return /node_modules/.test(modulePath) &&
!/node_modules\/@patternfly/.test(modulePath);
},
}
Webpack does not seem to respect:
{
test: /\.s?css$/,
exclude: /node_modules/,
include: [/node_modules\/@patternfly/],
}
source: webpack/webpack#2031 (comment)
cc: @dgutride
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.
@priley86 It looks like this change pulls in a bunch of CSS we don't use and increases our total CSS by 50%
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.
@spadgett - I'd agree with that assessment and this is a perfect use case for our more advanced PatternFly css architecture. For OpenShift, my recommendation would be to investigate use of a null loader (https://webpack.js.org/loaders/null-loader/) for the css require statements that have been introduced by react-core. Since your team is importing the full patternfly css from @ patternfly/patternfly - component specific css can be discarded.
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.
@dgutride we're not importing the full patternfly css... unfortunately null loader just results in a bunch of missing styles :/
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.
The end result is that you have the same amount of CSS but it is managed far more efficiently and you don't have to worry about garbage collection between routes or DOM bloat over time (and caching of css files leads to better efficiency).
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.
With @priley86's method, we're still seeing the inclusion of CSS for components we're not using. Is this intended?
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.
still seeing the inclusion of CSS for components we're not using
It in fact appears to be all components and utilities. This does not seem desirable.
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.
@priley86 confirmed all of PF4 CSS is pulled in only during dev as treeshaking occurs for prod and only relevant CSS is bundled.
The increase in the dist vendor bundle size is expected as the majority of PF4 CSS is no longer being injected in to head via emotion, but instead is being bundled.
@spadgett, this PR is ready for final review.
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.
please inspect webpack production build when checking this pf4 upgrade. there may be additional reductions we can add later.
c364428
to
5266b39
Compare
/retest |
e8635cb
to
a7be0ae
Compare
/retest |
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
Let's go ahead with this change. We can continue looking at webpack builds as follow-on work.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhamilto, spadgett The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
https://jira.coreos.com/browse/CONSOLE-1447