spring boot里vue 这个地方哪里错了为什么会说index.html有问题,怎样修改
望采纳!!! 可能是目录有中文。
在下菜鸟一枚,最近在学习roadhog2,关于html配置项这里老是报错。
参考1:
html-webpack-plugin作用:提取html到dist文件夹,并为html文件中引入的外部资源如script、link动态添加每次compile后的hash,防止引用缓存的外部文件问题。
参考资料之后:https://stackoverflow.com/questions/43494794/webpack-html-webpack-plugin-error-child-compilation-failed
发现是html-webpack-plugin和fild-loader同时处理html类型文件冲突,原先使用下面方法2去解决的,但是后来发现可能会有一些未知的坑,所以现在推荐大家使用下面那个哥们的方法(方法1).
方法1:
修改index.html后缀为index.ejs. 然后在webpackrc.js中配置html: { template: './src/index.ejs' },
方法2:
1、index.html不需要放public,public文件夹会被roadhog自动copy到dist文件下,所以index.html文件放src文件夹下也可以。并且不要引入css和js文件,html-webpack-plugin插件会帮我们自动提取。
2、 html配置项随便配置下。
"html":{
"template": "./src/index.html",
"title": "myApp"
},
**3、重点:将roadhog配置文件build.js和dev.js修改一下下,修改目的是去掉fild-loader处理html文件,修改如下:在文件中添加一个函数过滤下。
文件路径:roadhogDemo\node_modules\roadhog\lib\build.js
image
build.js和dev.js都这样搞下
**
再去npm start 或者build下看下。
image
再看下编译后的文件:/dist/index.html
image
把 Unititled-1.html 和 1.html 删除试试。。