postcss-loader: Function config does not work in webpack 2 with postcss-loader 1.0.0

To use a function config, parseOptions expects the typeof of the options to be a 'function', but that is not allowed by the webpack 2 schema.

https://github.com/postcss/postcss-loader/blob/master/index.js#L8-L11

WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.module.rules[4].use[2].options should be one of these:
   object | string
 - configuration.module.rules[4].use[2] should be one of these:
   string | object { loader?, options?, query? }

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 33 (28 by maintainers)

Most upvoted comments

@ai ๐Ÿ‘ tested it locally and your changes work fine, but can you wait maybe 1/2 days before release next minor ? ๐Ÿ˜ƒ final postcss-load-config needs onyl a few small fixes (mostly done) and testing for

if (plugin.default && typeof plugin.default === 'function')  plugin = plugin.default

e.g for postcss-sprites

The fixes and adding the above is really easy but Iโ€™m again busy requesting church asylum for someone, itโ€™s always extremely time consuming and when there is progress you need to be responsive quickly, itโ€™s really damaging to the โ€˜flowโ€™ currently, but bla bla bla ๐Ÿ˜› , the issue for autoprefixer/css-loader docs refactoring is also pending and I would also like to find and experiment with aliases for ctx.webpack. But the latter could also be part of next minor and load-config is a patch anyways, so in case you donโ€™t want to wait, go ahead ๐Ÿ˜Ž