-
-
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: check for name of HotModuleReplacementPlugin to avoid RangeError #2146
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2146 +/- ##
=======================================
Coverage 92.56% 92.56%
=======================================
Files 33 33
Lines 1265 1265
Branches 361 361
=======================================
Hits 1171 1171
Misses 87 87
Partials 7 7
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.
Good job, thanks!
For Bugs and Features; did you add new tests?
Yes
Motivation / Use-Case
Fixes #87, a long-standing subtle bug which seems to have tripped up a lot of people historically.
Breaking Changes
No breaking changes.
Additional Info
See my comment on the issue: #87 (comment). The only way I can see this solution being a problem is if we're worried about configs that are using
--hot
and also have a plugin that isn'tHotModuleReplacementPlugin
but has the same name. In that case, we'd no longer inject the real HMR plugin. I'm not sure how likely this is and I seem to remember seeing other webpack plugins that check the name string rather than relying on the constructor reference (probably for this same reason).However, if we are concerned and if there's a property we can additionally check on the instances of the plugin, that would potentially be more robust. Ideally it'd be a property that's existing on the
HotModuleReplacementPlugin
for a while to make it as backward-compatible as possible.