当我在web包项目中使用html-loader时出错



我正在设置webpack,但我有一个错误。当我尝试使用html-loader时,当我在webpack.config.js文件的模块中设置规则时,就会发生这种情况。它说子编译中有一个错误。我想知道为什么。

错误如下:

ERROR in child compilations (Use 'stats.children: true' resp.'-- 
stats-children' for more details)

下面是代码(谢谢你的帮助):

module.exports = {
mode: "development",
entry: path.resolve(__dirname, './src/index.js'),
output: {
path: path.resolve(__dirname, './dist'),
filename: 'main.js',
},
module: {
rules: [
{
test: /.html$/i,
use: [
{
loader: "html-loader",
options:{
minimize: true,
},
},
],
},
],
},
plugins: [new HtmlWebpackPlugin({
template: path.resolve(__dirname, './src/index.html'),
filename: "index.html",
})],
};

我的文件和文件夹

为了解决这个警告,您只需要添加统计。在你的webpack.mix.js文件中:true。首先打开你的webpack.mix.js文件,添加以下代码:

mix.webpackConfig({
stats: {
children: true,
},
});

最新更新