How do I suppress warnings generated by webpack loading post css files?
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 config:
module: {
loaders: [
...
{test: /\.css/, loader: 'style-loader!css-loader!postcss-loader'},
...
]
},
postcss: function () {
return [precss, autoprefixer];
}
Configure webpack css-loader and style-loader To be able to use CSS in your webpack app, you need to set up a new loader. Out-of-the-box, webpack only understands Javascript and JSON. With a loader, you can translate another type of file to a format that webpack understands and can work with.
PostCSS is a Node. js tool that transforms your styles using JavaScript plugins. It generates more downloads per week on NPM than other CSS preprocessors like Sass, Less, and Stylus combined.
PostCSS is: a tool for transforming styles with JS plugins. These plugins can lint your CSS, support variables and mixins, transpile future CSS syntax, inline images, and more.
Can you try adding
module.exports = {
entry: ...,
stats: {warnings:false}
...
}
You can use the stats.warningsFilter. Try with something like this:
module.exports = {
...
stats: {
warningsFilter: [
'./~/css-loader!./~/postcss-loader!./src/components/Navigator/Navigator.css'
]
}
...
}
You can add anything that appears in the warning, even with a regex or a function. More specific is better.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With