-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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(utils): use plugin to add entries for webpack@5 #2839
Conversation
This reverts commit 8bbef6a
Cherry-picked from webpack#2723. Co-authored-by: Loonride <[email protected]>
Codecov Report
@@ Coverage Diff @@
## v4 #2839 +/- ##
==========================================
+ Coverage 93.04% 93.08% +0.03%
==========================================
Files 39 40 +1
Lines 1309 1331 +22
Branches 349 354 +5
==========================================
+ Hits 1218 1239 +21
- Misses 87 88 +1
Partials 4 4
Continue to review full report at Codecov.
|
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.
It is very great idea
Some tests are still flaky 😞 |
Big thanks |
@ylemkimon Now we need focus on |
@evilebottnawi Thank you for the review! |
For Bugs and Features; did you add new tests?
Yes, added module federation test cherry-picked from #2723.
Motivation / Use-Case
Fixes #2484 and fixes #2692. Closes #2723.
Instead of modifying compiler configuration and calling
hooks.entryOption
after it has instantiated, this callscompilation.addEntry
to add dev server entries intoglobalEntry
, as suggested in #2692 (comment).As discussed in #2723 (review), the issue is with reusing the compiler instance with multiple dev servers, so I've decided to use a plugin, whose entries can be modified later.
I've considered using existing plugins:
EntryPlugin
: adds a single entry, so changing the number of entries is not possible because removing hooks is not supportedDynamicEntryPlugin
: adding a global entry, i.e.,name: undefined
, is not possible because name should be a string (https://git.io/JkleI)So I've created
DevServerEntryPlugin
based onDynamicEntryPlugin
. It would also allow easy detection.Breaking Changes
The signature of
webpack-dev-server/lib/utils/addEntries
has changed fromaddEntries(config, options, server)
toaddEntries(compiler, options, server)
, but GitHub code search shows no code is using this directly.Additional Info
The first three commits are revert or refactor. Diff ignoring whitespace changes would be better for reviewing changes.