Skip to content
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

Merged
merged 2 commits into from
Oct 4, 2016
Merged

Make webpackHotDevClient support webpack 2 too #840

merged 2 commits into from
Oct 4, 2016

Conversation

michalkvasnicak
Copy link
Contributor

@michalkvasnicak michalkvasnicak commented Oct 4, 2016

Support webpack 2 by webpackHotDevClient.

Closes #839

@facebook-github-bot
Copy link

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!

Copy link
Contributor

@gaearon gaearon left a 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) {
Copy link
Contributor

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.

Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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.

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@gaearon gaearon added this to the 0.7.0 milestone Oct 4, 2016
@gaearon gaearon merged commit 4feff2a into facebook:master Oct 4, 2016
@gaearon
Copy link
Contributor

gaearon commented Oct 4, 2016

Looks great.
I’ll release this some time next week.

kitze added a commit to kitze/custom-react-scripts that referenced this pull request Oct 6, 2016
…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)
feiqitian pushed a commit to feiqitian/create-react-app that referenced this pull request Oct 25, 2016
maltestenzel pushed a commit to maltestenzel/custom-react-scripts that referenced this pull request Mar 7, 2018
…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)
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants