webpack-dev-server icon indicating copy to clipboard operation
webpack-dev-server copied to clipboard

Option to console.log only important stuff

Open steida opened this issue 11 years ago • 14 comments

It is planned or should I send PR?

We don't care about these messages:

[HMR] Waiting for update signal from WDS...
client:14 [WDS] Hot Module Replacement enabled.

There should be an option (default) to log only warnings and errors.

steida avatar Feb 14 '15 01:02 steida

+1

maxdow avatar Feb 22 '15 10:02 maxdow

I agree the following are not useful logs and they are cluttering up my console making it more difficult to sort through and find my own logs.

[WDS] App updated. Recompiling...
[WDS] Nothing changed.

There should be some way for me to disable these logs. This same issue was filed on the react-hot-loader, but it is apparently a webpack issue (https://github.com/gaearon/react-hot-loader/issues/79).

smussell avatar May 21 '15 19:05 smussell

+1

elektronik2k5 avatar May 21 '15 20:05 elektronik2k5

Would like this option as well. The logs are a bit verbose after everything is setup correctly.

fusepilot avatar Jun 02 '15 03:06 fusepilot

:+1:

luisrudge avatar Jun 04 '15 15:06 luisrudge

+1 as well

FlorentD avatar Sep 15 '15 17:09 FlorentD

As a very messy temporary work around, I have a script, development.js which i conditionally append to the entry in webpack.config.js.

"use strict";

// This is a workaround used alongside the webpack-dev-server hot-module-reload feature
//  - it's quite chatty on the console, and there's no currently no configuration option
//    to silence it. Only used in development.
// Prevent messages starting with [HMR] or [WDS] from being printed to the console
(function(global) {
    var console_log = global.console.log
    global.console.log = function() {
        if (!(
            arguments.length == 1 &&
            typeof arguments[0] === 'string' &&
            arguments[0].match(/^\[(HMR|WDS)\]/)
        )) {
            console_log.apply(global.console,arguments)
        }
    }
})(window)

It overloads console.log - skipping any messages starting with [HMR] or [WDS]. It does the job - the fact that it's only used in development eases my discomfort at its horridness :-)

dalhundal avatar Sep 25 '15 11:09 dalhundal

Can you guys check if PR #579 works for you? Looking for feedback!

SpaceK33z avatar Aug 31 '16 18:08 SpaceK33z

PR #579 was merged, check that out for more info. Note that it hasn't been released yet.

SpaceK33z avatar Sep 04 '16 09:09 SpaceK33z

Released in 2.1.0-beta.3.

SpaceK33z avatar Sep 06 '16 08:09 SpaceK33z

Thanks for this @SpaceK33z

ghost avatar Dec 07 '16 07:12 ghost

Hi Out of nothing, I started seeing these messages in my terminal every time I update a file:

webpack built c6aa9a16a68277967229 in 3390ms
webpack built 3fdedc302da408daa8dd in 341ms

I narrowed it down to realize it only happens when I have webpackHotMiddleware enabled, even if I have noInfo: true, quiet: true set.

Any idea?

felipenmoura avatar Dec 14 '17 13:12 felipenmoura

Same issue, still see the logs with noInfo: true, quiet: true

al6x avatar Dec 30 '17 17:12 al6x

Thought it was bad form to leave console.log() lines in your production code...

pixelomo avatar Feb 23 '18 02:02 pixelomo