点我去Gitee
点我去Gitee

build 出现空白页解决办法

原文连接:https://www.cnblogs.com/nuister/p/12496570.html

build 出现空白页解决办法

项目执行npm run build后,将打包后的build文件放到 Nginx 配置中。

如果 react-router 路由 使用了 history 模式(即

那么在 Nginx 配置中必须加上:

location / {
        ··· ···
        try_files $uri /index.html;
        ··· ···
        }
    }

如果 react-router 路由 使用了 hash 模式(即)

那么在 Nginx 中不需要上面的配置。
但是,在使用url时要加上#

http://xxxx:3000/#/scan

若build报错

https://www.cnblogs.com/biuo/p/15311987.htm

posted @ 2021-10-16 14:40  biuo  阅读(138)  评论(0编辑  收藏  举报