If minimize is enabled and a browserslist config is present, the config is ignored. It looks to be ignored due to the from that is being sent to postcss.
pipeline.process(inputSource, {
// we need a prefix to avoid path rewriting of PostCSS
from: "/css-loader!" + options.from,
to: options.to,
...
})
When "/css-loader!" is prefixed to the from field the path sent to postcss, and eventually browserslist ends up being something like:
c:\\css-loader!c:\\src\\app\\something.css
browserslist splits on path.sep, so the only valid directory it will get is c:\
The only workaround right now is to either disable autoprefixer or place a browserslist config file at the root of the machine.
I had this same issue, though I don't understand the internals of Webpack enough to understand where things are falling through the cracks. I was able to get it working by manually setting an environment variable in my webpack.config.js like so: process.env.BROWSERSLIST = 'Last 3 versions';. You could also use the BROWSERSLIST_CONFIG env variable, setting it to a file path if your browser support is more complex than a one-liner. Here's the docs I referenced: https://github.com/ai/browserslist#config-file
I wasn't expecting this plugin to strip our vendor prefixes either. I'd prefer to see that automatic functionality removed because it's very confusing.
The automatic stripping of vendor prefixes has been disabled (#281), so this issue is no longer relevant.
Most helpful comment
I had this same issue, though I don't understand the internals of Webpack enough to understand where things are falling through the cracks. I was able to get it working by manually setting an environment variable in my
webpack.config.jslike so:process.env.BROWSERSLIST = 'Last 3 versions';. You could also use theBROWSERSLIST_CONFIGenv variable, setting it to a file path if your browser support is more complex than a one-liner. Here's the docs I referenced: https://github.com/ai/browserslist#config-file