webpack Html-webpack-plugin报错: Error: Child compilation failed
报错ERROR inError: Child compilation failed:Module not found: Error: Can't resolve 'D:\练习\webpack\index.html' in 'D:\练习\webpack'ModuleNotFoundError: Module not found: Error: Can't resolve 'D:\练习\webpack
·
报错
ERROR in Error: Child compilation failed:
Module not found: Error: Can't resolve 'D:\练习\webpack\index.html' in 'D:\练习\webpack'
ModuleNotFoundError: Module not found: Error: Can't resolve 'D:\练习\webpack\index.html' in 'D:\练习\webpack'
at D:\练习\webpack\node_modules\webpack\lib\Compilation.js:2016:28
at D:\练习\webpack\node_modules\webpack\lib\NormalModuleFactory.js:798:13
at eval (eval at create (D:\练习\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:10:1)
at D:\练习\webpack\node_modules\webpack\lib\NormalModuleFactory.js:270:22
at eval (eval at create (D:\练习\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:9:1)
at D:\练习\webpack\node_modules\webpack\lib\NormalModuleFactory.js:434:22
at D:\练习\webpack\node_modules\webpack\lib\NormalModuleFactory.js:116:11
at D:\练习\webpack\node_modules\webpack\lib\NormalModuleFactory.js:670:25
at D:\练习\webpack\node_modules\webpack\lib\NormalModuleFactory.js:855:8
at D:\练习\webpack\node_modules\webpack\lib\NormalModuleFactory.js:975:5
1 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
webpack 5.72.0 compiled with 2 errors in 167 ms
主要是因为index.html路径出问题导致的
const HtmlWebpackPlugin = require("html-webpack-plugin")
module.exports = {
plugins:[
new HtmlWebpackPlugin({
template:"./index.html",
})
]
}
把template里的路径改成src下的index
const HtmlWebpackPlugin = require("html-webpack-plugin")
module.exports = {
plugins:[
new HtmlWebpackPlugin({
template:"./scr/index.html",
})
]
}
更多推荐
已为社区贡献2条内容
所有评论(0)