Vue build idea run 运行报错
来源:16-3 Vue CLI多环境编译

Sinvirance
2021-08-16
Vue build idea run 运行报错:Failed to load resource: the server responded with a status of 404 (Not Found)
老师你好,在这一节 Vue build 打包运行时,在修改完配置文件 vue.config.js 文件后,idea右键run index.html, 出现页面Failed to load resource: the server responded with a status of 404 (Not Found) 报错,但是
- 路径还是相对路径,http://localhost:63342/course/admin/dist/index.html?_ijt=u4dd4lqcd1apk3sg8llgiq5ulo
- f12 项目并没有加载需要的各种静态文件,不是加载出错,而是没有不需要加载
- 查看index.html 打包后的代码,发现路径有被修改成相对路径,说明配置生效
- 直接打开不通过idea运行发现执行成功,页面显示正常 file:///D:/JavaProject/Mooc/course/admin/dist/index.html#/login
我尝试了去寻找解决方案
- 将 route.js 修改成hash模式,失败
- 配置文件中加入指定各种静态文件位置的配置,失败
请问老师,如何能像视频中一样run执行成功呢
写回答
1回答
-
甲蛙
2021-08-17
我演示的视频里,改了vue.config.js后,url会变成下面这样,你的没变,说明vue.config.js配置不正确,或位置放得不对。
目前这块还没有同学反馈有问题,跟着视频来是可以的。
012021-08-18
相似问题