Skip to content

Commit

Permalink
[fix] rebase onto 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
obulat committed Apr 11, 2023
1 parent d782e60 commit 347dae8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/webpack/src/utils/postcss.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export default class PostcssConfig {

/**
* Load plugins from postcssOptions
* @param {{ postcssOptions: {plugins?: unknown, order?: string | function}}} postcssOptions
* @param {{ postcssOptions: {plugins?: unknown, order?: string | function }}} postcssOptions
*/
loadPlugins (postcssOptions) {
const { plugins, order } = postcssOptions.postcssOptions
Expand Down Expand Up @@ -252,6 +252,14 @@ export default class PostcssConfig {

if (Array.isArray(postcssOptions.postcssOptions.plugins)) {
defaults(postcssOptions.postcssOptions.plugins, this.defaultPostcssOptions.plugins)
} else if (typeof postcssOptions.postcssOptions === 'function') {
const postcssOptionsFn = postcssOptions.postcssOptions
postcssOptions.postcssOptions = (loaderContext) => {
const result = this.normalize(postcssOptionsFn(loaderContext))
if (result) {
return result.postcssOptions
}
}
} else {
// Merge all plugins and use preset for setting up postcss-preset-env
if (postcssOptions.postcssOptions.preset) {
Expand Down

0 comments on commit 347dae8

Please sign in to comment.