postcss: Allow to disable "You did not set any plugins, parser, or stringifier. Right now, PostCSS does nothing. Pick plugins for your case on https://www.postcss.parts/ and use them in postcss.config.js." warning

Will be great to allow disable “You did not set any plugins, parser, or stringifier. Right now, PostCSS does nothing. Pick plugins for your case on https://www.postcss.parts/ and use them in postcss.config.js.” warning message using the option, for example noWarningOnEmptyOptions (maybe best name).

Why?

We use postcss in css-loader as the parser, but here cases when developer can disable all plugins (parsing url()/@import/css modules plugins), but css-loader still has sense because it is compile CSS to JS (or other type). It is rare cases, but they exists.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 21 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Is there any documentation anywhere that demonstrates the usage of this option? Searching the web for the string hideNothingWarning and PostCSS brings up nothing.

This is a hidden option, because in most of the cases, you should fix the problem, not hide a useful warning.

I am using Storybook in my Nuxt project, and it requires PostCSS be installed as a dev dependency. The issue is that while Storybook requires it, my main pages I build do not. Any time I run nuxt to generate the pages, I get a wall of warnings that are overshadowing more relevant errors and warnings. A clear way to suppress these warnings would be much appreciated.

Maybe it is a better way to fix Storybook and not call PostCSS if you do not use PostCSS plugins?

It turns out there is a bug logged for this issue in nuxt-community/storybook. For those with the same issue, It involves adding PostCSS as a build module in the nuxt config and updating the version of nuxt-community/storybook used. nuxt-community/storybook#266

I would still suggest that unnecessary clutter in the logs has led to a lot of frustration for those who are not directly using PostCSS in their projects, but have it as a dependency of a dependency. I have not created a project on the scale of PostCSS however, so perhaps the logs solve more issues than it creates. Just my thoughts on the topic.

Thanks for your response which indeed led to a resolution in my case. I will certainly go up the chain of dependencies in the future to seek a resolution at the root cause.

This warnings are very annoying… I only added postcss: null in the build config at nuxt.conf.js, something like this:

build: {
    postcss: null, 
    ...
}

It works well for me

PostCSS 8 will have hideNothingWarning option

Is there any documentation anywhere that demonstrates the usage of this option? Searching the web for the string hideNothingWarning and PostCSS brings up nothing.

This is a hidden option, because in most of the cases, you should fix the problem, not hide a useful warning.

I am using Storybook in my Nuxt project, and it requires PostCSS be installed as a dev dependency. The issue is that while Storybook requires it, my main pages I build do not. Any time I run nuxt to generate the pages, I get a wall of warnings that are overshadowing more relevant errors and warnings. A clear way to suppress these warnings would be much appreciated.

Maybe it is a better way to fix Storybook and not call PostCSS if you do not use PostCSS plugins?

It turns out there is a bug logged for this issue in nuxt-community/storybook. For those with the same issue, It involves adding PostCSS as a build module in the nuxt config and updating the version of nuxt-community/storybook used. nuxt-community/storybook#266 I would still suggest that unnecessary clutter in the logs has led to a lot of frustration for those who are not directly using PostCSS in their projects, but have it as a dependency of a dependency. I have not created a project on the scale of PostCSS however, so perhaps the logs solve more issues than it creates. Just my thoughts on the topic. Thanks for your response which indeed led to a resolution in my case. I will certainly go up the chain of dependencies in the future to seek a resolution at the root cause.

This warnings are very annoying… I only added postcss: null in the build config at nuxt.conf.js, something like this:

build: {
    postcss: null, 
    ...
}

It works well for me

If you use TypeScript (nuxt.config.ts) with interface NuxtConfig from @nuxt/types, then it’s better to use

build: {
    postcss: false, 
    ...
}

It would work well and you wouldn’t have to extend the NuxtConfig interface by yourself.

PostCSS 8 will have hideNothingWarning option

Is there any documentation anywhere that demonstrates the usage of this option? Searching the web for the string hideNothingWarning and PostCSS brings up nothing.

I am using Storybook in my Nuxt project, and it requires PostCSS be installed as a dev dependency. The issue is that while Storybook requires it, my main pages I build do not. Any time I run nuxt to generate the pages, I get a wall of warnings that are overshadowing more relevant errors and warnings. A clear way to suppress these warnings would be much appreciated.

Is there any documentation anywhere that demonstrates the usage of this option? Searching the web for the string hideNothingWarning and PostCSS brings up nothing.

This is a hidden option, because in most of the cases, you should fix the problem, not hide a useful warning.

I am using Storybook in my Nuxt project, and it requires PostCSS be installed as a dev dependency. The issue is that while Storybook requires it, my main pages I build do not. Any time I run nuxt to generate the pages, I get a wall of warnings that are overshadowing more relevant errors and warnings. A clear way to suppress these warnings would be much appreciated.

Maybe it is a better way to fix Storybook and not call PostCSS if you do not use PostCSS plugins?

It turns out there is a bug logged for this issue in nuxt-community/storybook. For those with the same issue, It involves adding PostCSS as a build module in the nuxt config and updating the version of nuxt-community/storybook used. https://github.com/nuxt-community/storybook/issues/266

I would still suggest that unnecessary clutter in the logs has led to a lot of frustration for those who are not directly using PostCSS in their projects, but have it as a dependency of a dependency. I have not created a project on the scale of PostCSS however, so perhaps the logs solve more issues than it creates. Just my thoughts on the topic.

Thanks for your response which indeed led to a resolution in my case. I will certainly go up the chain of dependencies in the future to seek a resolution at the root cause.

Don’t worry, in PostCSS 8.3 we will disable warning (but using lazy parsing, unnecessary PostCSS call will not affect performance)

I added unofficial hideNothingWarning option to ose branch 10d974f

Is there any documentation anywhere that demonstrates the usage of this option? Searching the web for the string hideNothingWarning and PostCSS brings up nothing.

This is a hidden option, because in most of the cases, you should fix the problem, not hide a useful warning.

I am using Storybook in my Nuxt project, and it requires PostCSS be installed as a dev dependency. The issue is that while Storybook requires it, my main pages I build do not. Any time I run nuxt to generate the pages, I get a wall of warnings that are overshadowing more relevant errors and warnings. A clear way to suppress these warnings would be much appreciated.

Maybe it is a better way to fix Storybook and not call PostCSS if you do not use PostCSS plugins?

@ai Kindly thank you for your advise - it’s almost exactly what I want to do 😃👍

But I’m currently using Next.js framework which is using PostCSS transformations out-of-the-box with no configuration (as stated in their documentation).

Documentation (https://nextjs.org/docs/advanced-features/customizing-postcss-config) contains PostCSS configuration example which points to split PostCSS configuration for production and development builds in following manner:

// postcss.config.js
module.exports = {
  plugins:
    process.env.NODE_ENV === 'production'
      ? [
          // Transformations done in production build           
        ]
      : [
          // No transformations in development
        ],
}

But when I supply empty array to “dev” config - warning arises.

While I understand presence of that warning in standard use-case (which is especially useful for newcommers and beginers like me 😅), I don’t understand why that warning can’t be simply suppressed or disabled, on demand, in some way 😦

Currently I’ve ended-up by configuration ["postcss-preset-env", { stage: false }] for DEV environment/builds which in my opinion disables any transformations (but not parsing itself?) by PostCSS (so, CSS code just “flows” untouched through the plugin) and keeps warning away from me. Also, I were looking for some “dummy” plugin but found nothing 😦

So, that’s why I’m asking how that warning could be disabled 😄

Any suggestions are welcome.