使用 Cloud Storage 和自定义域部署应用程序时出现空白页面

问题描述

我在尝试使用 Google Cloud Storage 和自定义域名部署 React 网站时遇到问题。

  1. 我使用 npm run build 在本地构建我的 React 应用。
  2. 将构建文件上传到名为 www.example.com 的存储桶。上传包含以下内容的 yaml:
runtime: nodejs10
handlers:
  - url: /
    static_files: build/index.html
    upload: build/index.html

  - url: /
    static_dir: build
  1. 打开云壳
  2. 运行gsutil rsync -r gs://www.example.com ./example
  3. 运行 cd ./example
  4. 运行gcloud app deploy
  5. 该应用在 https://example-dot-projectname.uc.r.appspot.com 网址上运行良好
  6. 该应用是 www.mycustomdomain.com 处的空白页
  7. 控制台读取 Loading Failed for the <script> with source "http://www.mycustomdomain.com/static.js/###.chunk.js" 两次
  8. 我还运行了 gsutil web set -m build/index.html gs://www.example.com,但没有奏效。

有什么想法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)