arco-design / arco-design-pro-vue

An out-of-the-box solution to quickly build enterprise-level applications based on Arco Design.
https://pro.arco.design
MIT License
1.35k stars 277 forks source link

bulid后通过nginx部署,页面是空白的 #125

Closed ahualy closed 2 years ago

ahualy commented 2 years ago

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; }

image
sHow8e commented 2 years ago

@ahualy hihi 我观察到你浏览器调试有个报错。可以看看报错是啥?在部署之前可以在本地文件夹执行一下 npm run preview命令。如果能够打开预览表示项目层面可能没什么问题。应该去看看nginx部分的配置。3q

Yuxiaogang-Gavin commented 2 years ago

我这也是,报‘css 未载入,因为它的 MIME 类型 “text/html” 不是 “text/css”。’

sHow8e commented 2 years ago

@Yuxiaogang-Gavin hihi 这个问题在首次安装完nginx后我也遇到过。应该还是ngxin的配置或者是读写权限的问题。可以去搜索nginx的解决方法。

Yuxiaogang-Gavin commented 2 years ago

实施部署让我加上 type="text/css",这个如何配置,还有如何给index.html配置css和js配置二级路径 才能让build时生效。

sHow8e commented 2 years ago

@Yuxiaogang-Gavin 这个着实是NGINX配置错误后返回的问题。不需要配置 type="text/css"。你可以先运行一下 npm run preview看看预览是否能打开。第二个问题看vite的文档。

Yuxiaogang-Gavin commented 2 years ago

@sHow8e 是的,感谢