CONSOLE-3853: Prevent PatternFly styles from being included in plugin compilation#13388
Conversation
|
@vojtechszocs: This pull request references CONSOLE-3853 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.15.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
| ...parseDeps( | ||
| rootPackage, | ||
| ['ajv', 'chalk', 'comment-json', 'find-up', 'read-pkg', 'semver'], | ||
| ['ajv', 'chalk', 'comment-json', 'find-up', 'glob', 'read-pkg', 'semver'], |
There was a problem hiding this comment.
This essentially adds glob to @openshift-console/dynamic-plugin-sdk-webpack package dependencies.
| compiler.options.output.publicPath = publicPath; | ||
|
|
||
| compiler.options.resolve = compiler.options.resolve ?? {}; | ||
| compiler.options.resolve.alias = compiler.options.resolve.alias ?? {}; |
There was a problem hiding this comment.
FYI, can't use the ??= operator here due to an older Prettier version.
| // Prevent PatternFly styles from being included in the compilation | ||
| getPatternFlyStyles().forEach((cssFile) => { | ||
| if (Array.isArray(compiler.options.resolve.alias)) { | ||
| compiler.options.resolve.alias.push({ name: cssFile, alias: false }); |
There was a problem hiding this comment.
options.resolve.alias is typically an object, but webpack also allows for an array representation.
|
@vojtechszocs: This pull request references CONSOLE-3853 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.15.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
@vojtechszocs: This pull request references CONSOLE-3853 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.15.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
@vojtechszocs: This pull request references CONSOLE-3853 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.15.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/test e2e-gcp-console |
/retest |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: TheRealJon, vojtechszocs The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
QE Approver: |
|
/label docs-approved |
|
Checked the code according to @vojtechszocs 's detailed steps, compared files in dist-before and dist-after, And also could see the difference in vendors-node_modules_patternfly_react-core_dist_esm_index_js-chunk.js : /label qe-approved |
|
@vojtechszocs: This pull request references CONSOLE-3853 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.16.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/label px-approved |
|
@vojtechszocs: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
|
[ART PR BUILD NOTIFIER] This PR has been included in build openshift-enterprise-console-container-v4.16.0-202312091410.p0.gad807f6.assembly.stream for distgit openshift-enterprise-console. |
This PR patches
ConsoleRemotePluginto ensure that PatternFly styles are not included when building a dynamic plugin.This should reduce the risk of having styling related bugs, i.e. some plugin overriding PatternFly styles provided by Console.
Reference:
resolve.aliasoptionsearchIgnoredStylesfunctionHow to verify changes in this PR
masterbranch:(cd dynamic-demo-plugin ; mv dist dist-before)(cd dynamic-demo-plugin ; mv dist dist-after)You can now use a visual diff tool like Meld to compare before vs. after build output:
vendors-node_modules_patternfly_react-core_dist_esm_index_js-chunk.jswill refer to these empty CSS modules, for example: