//报错写法
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css',
}),
//正确写法
new MiniCssExtractPlugin.default({
filename: '[name].css',
chunkFilename: '[id].css',
}),
//分析原因
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
console.log(MiniCssExtractPlugin);
打印MiniCssExtractPlugin类型信息
{
default: [class MiniCssExtractPlugin] {
pluginName: 'mini-css-extract-plugin',
pluginSymbol: Symbol(mini-css-extract-plugin)
}