-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
refactor: getTypes in asset/css generator #19573
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
base: main
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #19573 will degrade performances by 74.28%Comparing Summary
Benchmarks breakdown
|
lib/ModuleTypeConstants.js
Outdated
WEBPACK_MODULE_TYPE_PROVIDE, | ||
WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE, | ||
WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY | ||
]); |
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.
Looks like we need types here to catch cases when we added a new type and forgot about it, I think we need something like ALL_MODULES
and using Exclude
/Pick
ts helper here, just idea
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.
So it will be like: const ALL_MODULES = new Set(Object.values(module.exports)
and then do some filter logic. To ensure correctness, ALL_MODULES must be defined after all export statements, as its value depends on the order of module definitions.
Maybe we can organize moduleTypes
into separate files based on its category, i.e.
lib/JavascriptModuleTypeConstants.js
, lib/CssModuleTypeConstants.js
. Then in ModuleTypeConstants.js
we re-export all constants, and also define AllJsModuleTypes
and AllCssModuleTypes
...
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.
Yeah make sense too, do you want to try it?
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.
Yeah make sense too, do you want to try it?
Yeah. Try now.
What kind of change does this PR introduce?
Refactor the getTypes logic to exclude generation when the original module is not an official JavaScript or CSS module.
Did you add tests for your changes?
Exists now but feel free to ask more
Does this PR introduce a breaking change?
No
What needs to be documented once your changes are merged?
No