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

Cannot mute [HMR] Waiting for update signal from WDS... in browser console #2932

Closed
1 of 2 tasks
noelebrun opened this issue Dec 16, 2020 · 6 comments · Fixed by #3159
Closed
1 of 2 tasks

Cannot mute [HMR] Waiting for update signal from WDS... in browser console #2932

noelebrun opened this issue Dec 16, 2020 · 6 comments · Fixed by #3159

Comments

@noelebrun
Copy link

  • Operating System: macOS 11.1

  • Node Version: v14.12.0

  • NPM Version: v6.14.8

  • webpack Version: v5.10.1

  • webpack-dev-server Version: 4.0.0-beta.0

  • Browser: Chrome & Safari

  • This is a bug

  • This is a modification request

Code

{
  ...
  devServer: {
    client: {
      logging: 'none',
     ...
    },
    ...
  },
}

Expected Behavior

Setting client logging to none should suppress completely all client log, including from the hot chunk.

Actual Behavior

The log [HMR] Waiting for update signal from WDS... is still outputted to browser console when loading the page.

For Bugs; How can we reproduce the behavior?

Simply start webpack-dev-server with any kind of configuration (just don't pass hot: false), and check the browser console when the page has loaded.

From what I understood, that's because the default logging level of the hot chunk is info, and it is overwritten by webpack-dev-server client by calling the exported setLogLevel function.

But that function is only called once the webpack-dev-server client receives a logging command that is send when creating the socket server. That only happens after the web server has been started and is listening.

That specific logging happens as soon as the hot chunk is loaded, which is before the webpack-dev-server client receives that logging command from the socket server.

I don't have enough context to know which would be the best way to solve this, but let's start a discussion about it in here.

@noelebrun
Copy link
Author

I guess it wouldn't make sense for the hot chunk to wait for anything from webpack-dev-server client before logging since the whole purpose of this log is that inform that it's waiting for that.

Maybe simply adding a timeout and changing the log to something like Nothing received from WDS after *X*s if nothing was received by then?

@alexander-akait
Copy link
Member

We should run this https://github.com/webpack/webpack/blob/911ec1aa67011e25aa1449610f5b0b557edd5459/hot/log.js#L45, no need to timeouts or other unnecessary hacks

@noelebrun
Copy link
Author

noelebrun commented Dec 16, 2020

We should run this https://github.com/webpack/webpack/blob/911ec1aa67011e25aa1449610f5b0b557edd5459/hot/log.js#L45, no need to timeouts or other unnecessary hacks

I'm not sure to understand how that would solve the issue? Until you receive the socket command, you don't know what's the actual logging configuration so you would need a default value.

If that default value isn't none, that doesn't solve the issue. And if it is, then it simply remove the whole purpose of that log (which I think is valuable, it shows that the client has been loaded properly even if something went wrong with webpack-dev-server).

@alexander-akait
Copy link
Member

You can use warn or error, if you need keeping errors and warnings

@noelebrun
Copy link
Author

noelebrun commented Dec 16, 2020

If the client is loaded, but webpack-dev-server doesn't and so just doesn't send anything, would there be any kind of logs/warning? Indeed, the client would log anyway if it's unable to establish the WS connection. In that case I would suggest just getting rid of this log completely then. Wdyt?

@alexander-akait
Copy link
Member

alexander-akait commented Dec 16, 2020

We can't because it is part of webpack, not webpack-dev-server. I have an idea (we can pass options from webpack to client entry, like we do for web socket host/port/etc, set level and avoid sending unnecessary web socket message, I think it will be easy to solve), but this is not high priority, you can send a PR if you need it in the next release

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 a pull request may close this issue.

2 participants