fix(cli): fix autoprefixer plugin conditions (#12052)

This commit is contained in:
neverland 2023-07-02 10:27:55 +08:00 committed by GitHub
parent a789418366
commit 47a3aea291
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,11 +14,15 @@ function getPostcssPlugins(rootConfig) {
const plugins = rootConfig.plugins || [];
if (Array.isArray(plugins)) {
const hasPostcssPlugin = plugins.find(
(plugin) =>
plugin === 'autoprefixer' && plugin.postcssPlugin === 'autoprefixer'
const hasAutoprefixerPlugin = plugins.find(
(plugin) => {
if (typeof plugin === 'object') {
return plugin.postcssPlugin === 'autoprefixer';
}
return plugin === 'autoprefixer';
}
);
if (hasPostcssPlugin) {
if (hasAutoprefixerPlugin) {
return plugins;
}