-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Make webpackHotDevClient support webpack 2 too #840
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! |
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.
A few nits
@@ -272,8 +272,7 @@ function tryApplyUpdates(onHotUpdateSuccess) { | |||
return; | |||
} | |||
|
|||
// https://webpack.github.io/docs/hot-module-replacement.html#check | |||
module.hot.check(/* autoApply */true, function(err, updatedModules) { | |||
var checkCallback = function(err, updatedModules) { |
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.
Let’s call this handleApplyUpdates
.
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.
Minor nit: let’s also make this a regular function declaration, i.e. function handleApplyUpdates(...)
// https://webpack.github.io/docs/hot-module-replacement.html#check | ||
var result = module.hot.check(/* autoApply */true, checkCallback); | ||
|
||
// webpack 2 support |
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.
// Webpack 2 returns a Promise instead of invoking a callback
function(updatedModules) { | ||
checkCallback(null, updatedModules); | ||
}, | ||
checkCallback |
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.
For explicitness let’s also write this as a function that passes error as the first argument and null
as a second one.
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Looks great. |
…react-app # By Dan Abramov (2) and others # Via Dan Abramov * 'master' of https://github.com/facebookincubator/create-react-app: Correct a comment mistype in webpack production config (facebook#855) load setupTests file at setupTestFramework stage (facebook#846) Spell check (facebook#845) Tweak readme Update instructions on publishing to GitHub pages (facebook#841) Make webpackHotDevClient support webpack 2 too (facebook#840) Tweak eject output Promote "React must be in scope" to be an error (facebook#822) Fix script name to open chrome (facebook#831)
* Support webpack 2 * Code style
…react-app # By Dan Abramov (2) and others # Via Dan Abramov * 'master' of https://github.com/facebookincubator/create-react-app: Correct a comment mistype in webpack production config (facebook#855) load setupTests file at setupTestFramework stage (facebook#846) Spell check (facebook#845) Tweak readme Update instructions on publishing to GitHub pages (facebook#841) Make webpackHotDevClient support webpack 2 too (facebook#840) Tweak eject output Promote "React must be in scope" to be an error (facebook#822) Fix script name to open chrome (facebook#831)
Support webpack 2 by
webpackHotDevClient
.Closes #839