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

No respect, no respect at all! (for stats.warningsFilter 😉) #1557

Closed
1 of 2 tasks
missalyss opened this issue Nov 1, 2018 · 11 comments · Fixed by #1665
Closed
1 of 2 tasks

No respect, no respect at all! (for stats.warningsFilter 😉) #1557

missalyss opened this issue Nov 1, 2018 · 11 comments · Fixed by #1665

Comments

@missalyss
Copy link

  • Operating System: mac OS Sierra 10.12.6
  • Node Version: 6.11.1
  • NPM Version: 3.10.10
  • webpack Version: 4.19.0
  • webpack-dev-server Version: 3.1.8
  • This is a bug
  • This is a modification request

Code

webpack.config_.dev_.js

  //...
devServer: {
    host: '0.0.0.0',
    port: WEBPACK_PORT,
    watchOptions: {
      aggregateTimeout: 300,
      poll: true
    },
    stats: {
      assets: false,
      children: false,
      colors: true,
      version: false,
      hash: false,
      timings: true,
      chunks: false,
      chunkModules: false,
      warningsFilter: '[mini-css-extract-plugin]'
    },
    headers: {
      'Access-Control-Allow-Origin': '*'
    }

Webpack config stats docs I'm going off of:
https://webpack.js.org/configuration/stats/#stats

WDS stats docs:
https://webpack.js.org/configuration/dev-server/#devserver-stats-

Expected Behavior

While using stats.warningsFilter in my configuration, then it would be respected by webpack-dev-server, and that errors of anything from stats.warningsFilter would be filtered out and not posted to my browser's console. The closest to addressing logging that I can find in your code is this line, or several other lines that check for stats.colors from the same file.
Note: I am certain that my stats are connected correctly, because setting my stats.colors to false turns the colors off.

Actual Behavior

When adding warningsFilter: '[mini-css-extract-plugin]' to my config, errors from Webpack-Dev-Middleware are respected, and I no longer see them:

[webpack] ℹ 「wdm」: Compiled with warnings.

However, I am still getting my warnings in the browser's console:

screen shot 2018-11-01 at 3 41 11 pm

Which is originating from

log.warn('[WDS] Warnings while compiling.');

For Bugs; How can we reproduce the behavior?

Hmm I guess you'd need to set up a warning that you would try to filter out with your webpack config. Open browser console, errors persist with each page reload.

Note: when I update webpack-dev-server to latest version (3.1.10), problem still persists.

Thank you in advance!

@alexander-akait
Copy link
Member

@missalyss looks like a bug, feel free to investigate and send a PR

@missalyss
Copy link
Author

@evilebottnawi to your knowledge, does your client have access to webpack config at all? I've been trying to send it from bin/webpack-dev-server, but it doesn't want to read it.

@ralph-cheng
Copy link

ralph-cheng commented Dec 28, 2018

@evilebottnawi

I have also encountered this problem, except the warnings are from a different loader (ts-loader).

Setting a proper stats.warningsFilter, as described in ts-loader doc, does eliminate the warning from terminal output, but not from browser console.

I found the root cause is browser console log is collected using a hard-coded stats option without consulting the stats option from config at all. See code at

Maybe we could fixed it by merging the hard-coded stats option with the one passed in constructor.

@alexander-akait
Copy link
Member

Should be fixed, but we need add test for warningsFilter option as described in original issue

@yoannmoinet
Copy link
Contributor

@evilebottnawi I'm making the PR... totally forgot about that test.

@alexander-akait
Copy link
Member

@yoannmoinet will be great, thanks!

@yoannmoinet
Copy link
Contributor

Here you go @evilebottnawi #1732

@alexander-akait
Copy link
Member

Fixed #1732

@yoannmoinet
Copy link
Contributor

@evilebottnawi Thanks!
Do you know when there will be a release?

@alexander-akait
Copy link
Member

In near future

@Youpinadi
Copy link

Thx for this @yoannmoinet ! Can't wait to get it!

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

Successfully merging a pull request may close this issue.

5 participants