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

Set HMR log level. #926

Merged
merged 6 commits into from Jul 10, 2017
Merged

Set HMR log level. #926

merged 6 commits into from Jul 10, 2017

Conversation

lbogdan
Copy link
Contributor

@lbogdan lbogdan commented Jun 1, 2017

Second take at fixing the HMR logging issue (first was here) - not being able to turn off HMR's console logging. This change makes HMR respect webpack-dev-server's clientLogLevel.
It uses webpack/hot/log merged here.

What kind of change does this PR introduce?
This is a bugfix.

Did you add or update the examples/?
None needed.

Summary
See #925.

Does this PR introduce a breaking change?
This needs a webpack version with webpack/webpack#4960 merged, otherwise require("webpack/hot/log") will error. That's why the tests failed.

@lbogdan
Copy link
Contributor Author

lbogdan commented Jun 1, 2017

Maybe we should check if webpack/hot/log exists?

var hotCtx = require.context("webpack/hot", false, /^\.\/log$/);
if(hotCtx.keys().length > 0) {
  hotCtx("./log").setLogLevel(level);
}

@codecov
Copy link

codecov bot commented Jun 12, 2017

Codecov Report

Merging #926 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #926   +/-   ##
=======================================
  Coverage   72.13%   72.13%           
=======================================
  Files           4        4           
  Lines         463      463           
  Branches      139      139           
=======================================
  Hits          334      334           
  Misses        129      129

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 140da45...eb0f88a. Read the comment docs.

@shellscape
Copy link
Contributor

Looks good, but we need to wait for a pending major release before we merge. Didn't want to leave you hanging there.

@lbogdan
Copy link
Contributor Author

lbogdan commented Jun 14, 2017

A webpack release, you mean?

@shellscape
Copy link
Contributor

We're actually going to be doing a webpack-dev-server major release soon. It may correspond with webpack.

@lbogdan
Copy link
Contributor Author

lbogdan commented Jun 14, 2017

Makes sense. It would be nice to be able to get rid of the webpack/hot/log check, like in the initial commit. Thanks for the heads up!

@shellscape
Copy link
Contributor

This needs a webpack version with webpack/webpack#4960 merged, otherwise require("webpack/hot/log") will error. That's why the tests failed.

@lbogdan since this module is going to continue to support older versions of webpack, we're going to need some error catching around this change. We can't just let it throw cause it'll affect those unable to upgrade webpack.

once we get that in place I think we'll be good to go on this

@lbogdan
Copy link
Contributor Author

lbogdan commented Jul 10, 2017

@shellscape The last commit has error catching (more like "feature" checking, actually). That's why the tests pass. Can you please check?

@shellscape
Copy link
Contributor

@lbogdan cool, looks good to me. there's a conflict that needs resolving and then we can merge

@lbogdan
Copy link
Contributor Author

lbogdan commented Jul 10, 2017

@shellscape Fixed conflicts, everything looks good.

Also, I saw that with #921 webpack-dev-server is now using the loglevel package for logging. Maybe use it in webpack, too?

@shellscape
Copy link
Contributor

Unfortunately I'm not privy to the workings of webpack main. It might be worth raising an issue there.

@shellscape shellscape merged commit 6da2f38 into webpack:master Jul 10, 2017
@lbogdan
Copy link
Contributor Author

lbogdan commented Jul 10, 2017

Oh, ok, I was under the impression that webpack and webpack-dev-server have pretty much the same maintainers. 😃

@shellscape
Copy link
Contributor

I think there's some cross-polination between them all, but it's not 1:1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants