Skip to content

Build fails with OptimizeCSSAssetsPlugin since css-loader v4 #1135

Closed
@danielbachhuber

Description

@danielbachhuber
  • Operating System: Mac OS 10.15.5
  • Node Version: 10.15.1
  • NPM Version: 6.14.7
  • webpack Version: 4.44.0
  • css-loader Version: 4.0.0

Expected Behavior

image

Actual Behavior

image

Code

// webpack.config.js
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const WebpackNotifierPlugin = require( 'webpack-notifier' );

module.exports = [
	{
		entry: {
			"admin.css": "./assets/scss/admin.scss",
		},
		mode: process.env.NODE_ENV,
		output: {
			path: __dirname,
			filename: './assets/dist/[name]',
		},
		module: {
			rules: [
				{
					test: /\.s?css$/,
					use: [MiniCssExtractPlugin.loader, 'css-loader'],
			}
			]
		},
		plugins: [
			new WebpackNotifierPlugin(),
			new MiniCssExtractPlugin(),
			new OptimizeCSSAssetsPlugin()
		]
	},
];

How Do We Reproduce?

admin.scss is an empty file. If I comment out new OptimizeCSSAssetsPlugin(), the build succeeds as expected.

Any suggestions on how I can debug further?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions