异常:
ERROR in Error: Child compilation failed:
Entry module not found: Error: Can't resolve 'D:\VueProjects\Protal_works\webpack配置vue\index.html' in 'D:\VueProjects\Protal_works\w ebpack配置vue':
Error: Can't resolve 'D:\VueProjects\Protal_works\webpack配置vue\index.html' in 'D:\VueProjects\Protal_works\webpack配置vue'
粘一下插件版本:
这是因为:index.html路径问题导致( 模板路径是相对于项目最外层的package.json)
- webpack.config.js 部分代码:
const HtmlWebpackPlugin = require("html-webpack-plugin");
...
plugins: [
new HtmlWebpackPlugin({
template:'index.html',
})
],
解决方法:正确的找到模板的路径,我这里是
new HtmlWebpackPlugin({
template:'./src/index.html', //注意 index 的路径
})