Skip to content

Accept a custom postcss in the config? #510

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

Closed
phated opened this issue Jan 14, 2021 · 3 comments
Closed

Accept a custom postcss in the config? #510

phated opened this issue Jan 14, 2021 · 3 comments

Comments

@phated
Copy link
Contributor

phated commented Jan 14, 2021

  • Operating System: Mac
  • Node Version: ^14
  • NPM Version: ^6
  • webpack Version: ^4
  • postcss-loader Version: 4.1.0

Feature Proposal

I'd like to pass the postcss() function as an argument to this loader. If the postcss function isn't passed, it can fallback to loading from the peerDependency.

I'm happy to contribute this feature if you think it would be helpful!

Feature Use Case

postcss-loader is embedded deep into the core of Storybook and v3 implicitly caused a dependency on PostCSS 7. That is fine, because this loader can be upgraded and a dependency for ^7.0.35 can be added. However, some consumers want PostCSS 8, but it is a breaking change to bump that internal dependency.

If the postcss() function could be specified, it could be exposed as a configuration option that allows people to opt-in to PostCSS 8 support but would fallback to the v7 dependency otherwise.

@alexander-akait
Copy link
Member

Sorry, out of scope, it will only confuse new developers, and people will start using it without understanding why it is needed, you can validate version of postcss on your side and throw error/warning, you can even do it inside configuration

@phated
Copy link
Contributor Author

phated commented Jan 15, 2021

Thanks for your feedback. We will be able to do your suggestion in the future by requiring users to add postcss as a peerDep, but that is a breaking change to our current users.

We will likely have to use a fork of this loader until we are able to make a breaking change.

@alexander-akait
Copy link
Member

Fixed in master, release will be today

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

No branches or pull requests

2 participants