thread-loader: The loader does not apply config after search up the directory tree for configuration

  • Operating System: Windows 10
  • Node Version: v14.9.0
  • NPM Version: 6.14.8
  • webpack Version: 4.44.1
  • postcss-loader Version: 4.0.0

Expected Behavior

I have postcss.config.js file in the root of the project, my webpack.config.js is imported from ./webpack/app folder. I expect my postcss configuration to be used/applied correctly.

Actual Behavior

Running webpack ends up with console messages:

You did not set any plugins, parser, or stringifier. Right now, PostCSS does nothing. Pick plugins for your case on https://www.postcss.parts/ and use them in postcss.config.js.

And the postcss.config.js file is actually loaded - I’ve tried to add simple console.log('Im here') to it, and this message appears in my console, as expected. But, apparently, options exported from that file are not correctly sent to postcss.

Code

// webpack.config.js
{
...
module: {
		rules: [
			{
				test: /\.css$/,
				use: [
					MiniCssExtractPlugin.loader,
					{
						loader: 'css-loader',
						options: {
							importLoaders: 1
						}
					},
					{
						loader: 'postcss-loader'
					}
				]
			},
			{
				test: /\.less$/,
				include: APPROOT,
				use: [
					MiniCssExtractPlugin.loader,
					{
						loader: 'css-loader',
						options: {
							importLoaders: 2
						}
					},
					{
						loader: 'postcss-loader'
					},
					{
						loader: 'less-loader'
					}
				]
			}
		]
	}
...
}
// postcss.config.js
module.exports = {
	plugins: [
		'autoprefixer'
	]
};

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 24 (14 by maintainers)

Most upvoted comments

@evilebottnawi I simplified the test case config as you suggested: https://github.com/stefanmaric/postcss-loader-monorepo-test/commit/018456f44f6980248a2103d29c0f6d2ac1d03071

As well as in the project I’m working with.

Thanks!

@evilebottnawi thanks for the tips! I will apply them to test repo as well to have the test case use contrib modules only. I extracted those bits from the project I’m working on which has been maintaining a webpack config in prod since 2016 — it is actually amazing it is not an uglier Frankenstein 😄

I will take a look at thread-loader and see, don’t think I’m in capacity to fix it but will try.