Skip to content

docs(README): use an array of plugins in the example config - #278

Merged
ai merged 1 commit into
postcss:mainfrom
wahidrizka:docs-array-plugins-example
Sep 29, 2026
Merged

ai merged 1 commit into
postcss:mainfrom
wahidrizka:docs-array-plugins-example

Conversation

@wahidrizka

Copy link
Copy Markdown
Contributor

Closes #224.

postcss-loader marks the {Object} form of plugins as deprecated ("will be removed in the next major release" in its README, for both webpack.config.js and postcss.config.js), and the config in the Examples section, which the webpack example loads, still used it. As suggested in #224, it now uses an {Array}:

plugins: [
  require('postcss-import')(),
  require('postcss-nested')(),
  ctx.env === 'production' ? require('cssnano')() : false
]

The plugins are required rather than listed by name (as in postcss-loader's own examples), because postcss-load-config rejects names in an {Array} (Invalid PostCSS Plugin found at: plugins[0]). postcss-load-config and postcss-loader both accept this form, and both skip false. A note next to the {Object} form mentions the deprecation.

I ran the old and the new config in development and production through postcss-load-config 6.0.1 and main (on a CSS file with @import and nesting, and on SugarSS with the README's { parser: true, map: 'inline' } context) and through webpack 5.111.1 with postcss-loader 8.2.1 (on the CSS file). The output is identical in all 10 runs, and a control config without postcss-nested differs in all of them.

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 postcss#224
@ai
ai merged commit b648a18 into postcss:main Sep 29, 2026
@ai

ai commented Sep 29, 2026

Copy link
Copy Markdown
Member

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecated config in example

2 participants