打包vue文件后页面空白,出现报错

报错如下:

Refused to apply style from 'http://127.0.0.1:5500/css/chunk-43aa77e1.33bcbef1.css' because its MIME type ('text/html') is 
not a supported stylesheet MIME type, and strict MIME checking is enabled.Failed to load resource: the server responded 
with a status of 404 (Not Found)

此块代码意思为:
拒绝应用’http://127.0.0.1:5500/css/chunk-43aa77e1.33bcbef1.css’,因为它的MIME类型(‘text/html’)不是受支持的样式表MIME类型,并且需要严格的MIME检查已启用。失败加载资源:服务器的响应状态为404(未找到)

Failed to load resource: the server responded with a status of 404 (Not Found)

此块代码意思为:
未能加载资源:服务器响应状态为404(未找到)

引起此类报错的原因是因为js、css等文件过多,需手动添加(./)获取当前文件路径,但js等文件过多手动添加路径会引起冲突,
此类报错的解决方案为:在根目录中添加一个名为vue.config.js的文件,操作如下
在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/Z_hai_yan/article/details/115357903