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

Suppress warnings in console #147

Closed
pksjce opened this issue Sep 7, 2016 · 7 comments
Closed

Suppress warnings in console #147

pksjce opened this issue Sep 7, 2016 · 7 comments
Labels

Comments

@pksjce
Copy link

pksjce commented Sep 7, 2016

From @natew on March 15, 2015 0:18

We do dynamic route requires in a library that's used by people, and a lot of them are confused by this messaging:

WARNING in ./app/routes.js
Critical dependencies:
25:16-23 require function is used in a way, in which dependencies cannot be statically extracted

Beyond some sort of console.log override, is there a way to suppress this warning even if only in the server-side output?

Copied from original issue: webpack/webpack#887

@pksjce
Copy link
Author

pksjce commented Sep 7, 2016

From @dnutels on May 26, 2016 6:46

Is there no response? At all?

Having the ability to control the tool's logging level/output seems instrumental, yet there is currently no way to show only errors, while skipping (or folding) warnings...

@pksjce
Copy link
Author

pksjce commented Sep 7, 2016

From @jorilallo on June 5, 2016 1:6

I would like to see a way to suppress warnings as well. As per #1617 many popular libraries (e.g. Quill, localforage) come build with Browserify, I don't really see the point of repackaging them and installing random loaders in the process. I would much rather use the original if it works and not see the warning contantly.

@SpaceK33z
Copy link
Member

SpaceK33z commented Oct 14, 2016

This has actually been possible for a while, but it just hadn't been documented.

You can find the documentation here.

tl;dr:

stats: {
  warnings: false
}

in the "root" of your webpack config, OR if you are using webpack-dev-server, in the devServer object.

@tnguyen14
Copy link

Is there a way to do this from the CLI?

@jedwards1211
Copy link

jedwards1211 commented Oct 24, 2017

@SpaceK33z is there a way to only suppress warnings on a certain line?

I have server code that runs from webpack bundle in prod and straight from babel-node in dev, and I want to suppress the dynamic require warning only for this file.

  if (typeof __WEBPACK__ !== 'undefined') {
    // flow-issue(toy-factory-tracker)
    const requireMigration = require.context('../migrations/', false, /\.js$/)
    migrations = requireMigration.keys().map(requireMigration)
  } else {
    migrations = (await promisify(glob)(path.resolve(__dirname, '..', 'migrations', '*.js'))).map(require)
  }

@Kielan
Copy link

Kielan commented Dec 11, 2017

@SpaceK33z please update documentation reference link, currently the link to the answer 404's

@skipjack
Copy link
Collaborator

skipjack commented Dec 11, 2017

@Kielan here you go:

https://webpack.js.org/configuration/stats/

(I fixed the link in @SpaceK33z comment as well)

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

No branches or pull requests

7 participants