webpack-contrib / postcss-loader

PostCSS loader for webpack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Accept a custom postcss in the config?

phated opened this issue · comments

  • 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.

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

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.

Fixed in master, release will be today