How to suppress warnings using webpack and post css

How to suppress warnings created when loading css file messages in webpack?

Warning example:

WARNING in ./~/css-loader!./~/postcss-loader!./src/components/Navigator/Navigator.css
postcss-custom-properties: C:\StackData\bd\src\components\Navigator\Navigator.css:33:9: variable '--active' is undefined and
 used without a fallback

My webpack configuration:

 module: {
    loaders: [
   ...
      {test: /\.css/, loader: 'style-loader!css-loader!postcss-loader'},
   ...
    ]
  },
  postcss: function () {
    return [precss, autoprefixer];
  }
+4
source share
2 answers

Can you try add

module.exports = {
  entry: ...,
  stats: {warnings:false}
  ...
}
+2
source

You make a mistake trying to hide this warning. This warning is rather a mistake by the way. You should just fix it. Using the var () function, which has no link or backup, is simply incorrect and will create an invalid value for browsers.

Source: author of postcss-custom-properties.

0
source

Source: https://habr.com/ru/post/1650876/


All Articles