Currently I have the following webpack configuration, which works fine:
{
loader: require.resolve('postcss-loader'),
options: {
ident: 'postcss',
plugins: () => [
require('postcss-flexbugs-fixes'),
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
],
flexbox: 'no-2009',
}),
],
},
},
Since I'm using the postcss configuration in several places, I want to centralize it in a postcss.config.js file.
My webpack config becomes :
{
loader: require.resolve('postcss-loader'),
options: {
ident: 'postcss',
config: {
path: './postcss.config.js'
},
},
}
My postcss.config.js file is in the same config folder, and looks like this:
module.exports = {
plugins: {
'postcss-flexbugs-fixes': {},
'autoprefixer': {
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
],
flexbox: 'no-2009',
}
}
}
Now the build is still working, but it seems that the postcss config is ignored (when I inspect the css, the vendor prefix are no longer there). Am I missing something here ? The postcss documentation is not very helpful...