Disabling autoprefixer in css-loader, explicitly using postcss-loader (#9899)

When the UglifyJsPlugin is used for production, it's setting the minimize property for the loaders in the pipeline. This was causing the css-loader to call cssnano which was itself then calling autoprefixer.

We were explicitly calling autoprefixer via the postcss-loader for all style loaders that utilized a preprocessor and specifying the list of supported browsers, specifically to set the prefixes for PhantomJS. When the autoprefixer was run as part of the css-loader, the list of browsers wasn't present and this was causing the prefixes that we added to be removed.

This removes the implicit use of autoprefixer from the css-loader and instead explicitly uses the postcss-loader for all style loaders, passing in the proper configuration.
This commit is contained in:
Brandon Kobel 2017-01-17 12:04:43 -05:00 committed by GitHub
parent e1b79a3ec1
commit 4540e39479

View file

@ -71,18 +71,18 @@ class BaseOptimizer {
const makeStyleLoader = preprocessor => {
let loaders = [
loaderWithSourceMaps('css-loader')
loaderWithSourceMaps('css-loader?autoprefixer=false'),
{
name: 'postcss-loader',
query: {
config: require.resolve('./postcss.config')
}
},
];
if (preprocessor) {
loaders = [
...loaders,
{
name: 'postcss-loader',
query: {
config: require.resolve('./postcss.config')
}
},
loaderWithSourceMaps(preprocessor)
];
}