问题描述
我在尝试使用 Google Cloud Storage 和自定义域名部署 React 网站时遇到问题。
- 我使用
npm run build
在本地构建我的 React 应用。 - 将构建文件夹上传到名为 www.example.com 的存储桶。上传包含以下内容的 yaml:
runtime: nodejs10
handlers:
- url: /
static_files: build/index.html
upload: build/index.html
- url: /
static_dir: build
- 打开云壳
- 运行
gsutil rsync -r gs://www.example.com ./example
- 运行
cd ./example
- 运行
gcloud app deploy
- 该应用在
https://example-dot-projectname.uc.r.appspot.com
网址上运行良好 - 该应用是 www.mycustomdomain.com 处的空白页
- 控制台读取
Loading Failed for the <script> with source "http://www.mycustomdomain.com/static.js/###.chunk.js"
两次 - 我还运行了
gsutil web set -m build/index.html gs://www.example.com
,但没有奏效。
有什么想法吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)