From d2693a206933b090c3d9ced092f550be9a3f889e Mon Sep 17 00:00:00 2001 From: Wahid Rizka Fathurrohman Date: Tue, 29 Sep 2026 10:27:34 +0700 Subject: [PATCH] docs(README): use an array of plugins in the example config postcss-loader marks the {Object} form of plugins as deprecated, and the Examples config, which the webpack example loads, still used it. Use an {Array} of required plugins, which postcss-load-config and postcss-loader both accept, and note the deprecation next to the {Object} form. Closes #224 --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index da23de0..c1f2ccf 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,8 @@ module.exports = ({ env }) => ({ > ℹ️ When using an `{Object}`, the key can be a Node.js module name, a path to a JavaScript file that is relative to the directory of the PostCSS config file, or an absolute path to a JavaScript file. +> ℹ️ `postcss-loader` for webpack marks the `{Object}` form as deprecated, so use the `{Array}` form in JS configs that it loads. + #### `{Array}` **.postcssrc.js** @@ -317,11 +319,11 @@ When using a `{Function}` (`postcss.config.js` or `.postcssrc.js`), it's possibl module.exports = (ctx) => ({ parser: ctx.parser ? 'sugarss' : false, map: ctx.env === 'development' ? ctx.map : false, - plugins: { - 'postcss-import': {}, - 'postcss-nested': {}, - cssnano: ctx.env === 'production' ? {} : false - } + plugins: [ + require('postcss-import')(), + require('postcss-nested')(), + ctx.env === 'production' ? require('cssnano')() : false + ] }) ```