Closed ahualy closed 2 years ago
@ahualy hihi 我观察到你浏览器调试有个报错。可以看看报错是啥?在部署之前可以在本地文件夹执行一下 npm run preview命令。如果能够打开预览表示项目层面可能没什么问题。应该去看看nginx部分的配置。3q
我这也是,报‘css 未载入,因为它的 MIME 类型 “text/html” 不是 “text/css”。’
@Yuxiaogang-Gavin hihi 这个问题在首次安装完nginx后我也遇到过。应该还是ngxin的配置或者是读写权限的问题。可以去搜索nginx的解决方法。
实施部署让我加上 type="text/css",这个如何配置,还有如何给index.html配置css和js配置二级路径 才能让build时生效。
@Yuxiaogang-Gavin 这个着实是NGINX配置错误后返回的问题。不需要配置 type="text/css"
。你可以先运行一下 npm run preview看看预览是否能打开。第二个问题看vite的文档。
@sHow8e 是的,感谢
Basic Info
Steps to reproduce
nginx 配置信息 location / { root /html/dist; index index.html index.htm; try_files $uri $uri/ @router; } location @router { rewrite ^.*$ /index.html last; }