-
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
OCPBUGS-35928: Improve control over PatternFly shared modules used in Console plugins #13992
OCPBUGS-35928: Improve control over PatternFly shared modules used in Console plugins #13992
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.
Just one minor nit. Take it or leave it :)
if (basePath) { | ||
acc[pkgName] = getDynamicModuleMap(basePath, indexModule, resolutionField); | ||
} | ||
|
||
return acc; |
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.
What if we used an immutable accumulator like this:
if (basePath) { | |
acc[pkgName] = getDynamicModuleMap(basePath, indexModule, resolutionField); | |
} | |
return acc; | |
return !basePath ? acc : { | |
...acc, | |
[pkgName]: getDynamicModuleMap(basePath, indexModule, resolutionField) | |
}; |
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.
@TheRealJon Good idea, I'd personally prefer non-negated variation like
return basePath
? { ...acc, [pkgName]: getDynamicModuleMap(basePath, indexModule, resolutionField) }
: acc;
@vojtechszocs: This pull request references Jira Issue OCPBUGS-35928, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. In 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 openshift-eng/jira-lifecycle-plugin repository. |
/jira refresh |
@vojtechszocs: This pull request references Jira Issue OCPBUGS-35928, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
Requesting review from QA contact: In 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 openshift-eng/jira-lifecycle-plugin repository. |
/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
/test e2e-gcp-console |
[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
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@vojtechszocs: all tests passed! Full PR test history. Your PR dashboard. 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-sigs/prow repository. I understand the commands that are listed here. |
@vojtechszocs: Jira Issue OCPBUGS-35928: All pull requests linked via external trackers have merged: Jira Issue OCPBUGS-35928 has been moved to the MODIFIED state. In 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 openshift-eng/jira-lifecycle-plugin repository. |
[ART PR BUILD NOTIFIER] This PR has been included in build openshift-enterprise-console-container-v4.17.0-202406260443.p0.g0a468b4.assembly.stream.el9 for distgit openshift-enterprise-console. |
1. Customize
node_modules
directories to search when parsing dynamic modulesNew
ConsoleRemotePlugin
optionsharedDynamicModuleSettings.modulePaths
can be used to customizenode_modules
directories to search when parsing dynamic modules. If not specified, the list will contain a single entry (as per existing logic):Taking ODF Console Plugin as an example, their webpack config changes the current work directory to accomodate for different plugin builds:
However, this breaks the default assumption of vendor packages installed at
{process.cwd}/node_modules
and ultimately results in tons of dynamic module related warnings like:To address this issue, plugins can now use the above mentioned option like so:
2. Discard Console provided PatternFly 4.x shared module metadata when using PF 5+
Older plugins using PatternFly 4.x rely on Console providing the following shared modules at runtime:
@patternfly/react-core
@patternfly/react-table
@patternfly/quickstarts
Newer plugins using PatternFly 5.x do NOT utilize above shared modules. Instead, they share individual PatternFly code bits (components, icons, functions, etc.) via dynamic modules (introduced in #13521).
To improve build performance and allow for smaller production builds, we now discard the Console provided PatternFly 4.x shared module metadata when we detect that the plugin uses PF 5+ (detection is based on
@patternfly/react-core
dependency).