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

Disable PostCSS deprecation warning #14440

Closed
thany opened this issue Apr 1, 2021 · 8 comments
Closed

Disable PostCSS deprecation warning #14440

thany opened this issue Apr 1, 2021 · 8 comments

Comments

@thany
Copy link

thany commented Apr 1, 2021

Describe the bug
Starting Storybook 6.2+ will trigger a deprecation warning, which will make the console output look quite noisy. The warning is about deprecating the implicit PostCSS loader, which is guess is fine to show... if it's actually being used. I'm not using any CSS in our project, and so I don't want such a warning to clutter the console output. My OCD wants to do away with warnings 😀, but this one seems to be hardcoded into Storybook.

In the source I can see that it's always generating that warning for everyone. Except if you explicitly add addon-postcss.

This seems backwards to me. Why should I add an addon that I don't need, in order to hide a warning about its functionality that I wasn't using in the first place??

To Reproduce
Steps to reproduce the behavior:

  1. Make sure not to have any CSS in the project
  2. Make sure not to accidentally install postcss-addon
  3. Start Storybook 6.2
  4. Watch the console.

Expected behavior
If not using PostCSS: don't bother the console with it.
If using PostCSS: do warn about installing the addon.

Screenshots
image

System
Please paste the results of npx sb@next info here.

Environment Info:

  System:
    OS: Windows 10 10.0.19042
    CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
  Binaries:
    Node: 14.16.0 - C:\Program Files\nodejs\node.EXE
    npm: 6.14.11 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 89.0.4389.114
    Edge: Spartan (44.19041.423.0), Chromium (89.0.774.63)
  npmPackages:
    @storybook/addon-docs: 6.2.1 => 6.2.1
    @storybook/addon-links: 6.2.1 => 6.2.1
    @storybook/addons: 6.2.1 => 6.2.1
    @storybook/react: 6.2.1 => 6.2.1

┆Issue is synchronized with this Asana task by Unito

@shilman
Copy link
Member

shilman commented Apr 1, 2021

@thany what's your proposed solution?

@thany
Copy link
Author

thany commented Apr 1, 2021

I'm not sure. On the one hand, a warning is neccesary for folks relying on postcss. On the other hand it's just noise for folks who don't use it. To them, it might even look like the warning is telling them to install said addon, which shouldn't be the goal of this warning... Isn't there a way to detect if postcss is (going to be) used?

Perhaps it's possible move the warning to trigger at runtime, rather than at build time. That might help to know when it's being used/called.

@heath-freenome
Copy link

heath-freenome commented Apr 2, 2021

@shilman We also do not use postCSS and this warning is more than annoying as we configured our builds to fail when any deprecation warning is thrown. How about providing a setting we can add to main.js (i.e. noPostcss: true)that 1) disables any post-css capabilities in storybook (if any) and 2) as a result stops printing the warning as well? That way people can turn it off as needed.

Although if you can also only throw that warning during runtime ONLY when necessary as @thany suggests that could also work.

@shilman shilman changed the title PostCSS deprecation warning Disable PostCSS deprecation warning Apr 2, 2021
@shilman shilman added this to the 6.2 stabilization milestone Apr 2, 2021
@thaoms
Copy link

thaoms commented Apr 4, 2021

I actually get this error and I'm not using postcss in our storybook itself, it's actually trying to run a postcss.config.js inside a node module import, while I'm just importing the dist css from that module. Seems like a bug?

@shilman
Copy link
Member

shilman commented Apr 5, 2021

Crikey!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.2.3 containing PR #14478 that references this issue. Upgrade today to the @latest NPM tag to try it out!

npx sb upgrade

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Apr 5, 2021
@kaelig
Copy link
Contributor

kaelig commented Apr 5, 2021

For people who can't upgrade to 6.2.3 yet, this is a workaround:

// Silence deprecation warnings about postcss
process.noDeprecation = true;

@JohnCasab
Copy link

JohnCasab commented Apr 6, 2021

If you dont use Postcss you can paste this in your .storybook/main.js

module.exports = {
  features: {
    postcss: false,
  },
};

As suggested in the documentation:
https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated-implicit-postcss-loader

filipesilva added a commit to filipesilva/athens that referenced this issue Sep 13, 2021
@jdgomezb
Copy link
Contributor

If you dont use Postcss you can paste this in your .storybook/main.js

module.exports = {
  features: {
    postcss: false,
  },
};

As suggested in the documentation: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated-implicit-postcss-loader

Yes, adding this property to the exports object fixed the warning issue

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

No branches or pull requests

7 participants