创建部署在 firebase 中的 react 应用程序显示空白屏幕

时间:2021-07-27 12:07:19

标签: reactjs firebase create-react-app

我遵循的步骤:

  1. npm i firebase-tools -g
  2. firebase 登录
  3. npm 运行构建
  4. firebase 初始化

#include <stdio.h> #include <stdlib.h> int main(int argc, char* argv[]){ int i, row,incre=0,change=0; for(i=0; i<18; i++){ if(change==0) { incre++; row =3-i%3; printf("%d ",row); if(incre>=3){ change=1; incre=0; //printf("\n"); } } else{ incre++; row =1+i%3; printf("%d ",row); if(incre>=3){ change=0; incre=0; //printf("\n"); } } } printf("\n"); return 0; }

5.firebase 部署 注意:我可以选择从现有项目中进行选择,我做到了。 firebase.json:

Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys What do you want to use as your public directory? (public) build Configure as a single-page app (rewrite all urls to /index.html)?(y/N) y Set up automatic builds and deploys with GitHub? (y/N) N File build/index.html already exists. Overwrite? (y/N) N

我的 index.html:

{
  "hosting": {
    "public": "build",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

部署后我等了 15-20 分钟才显示欢迎消息,现在我看到的只是一个空白屏幕。 我有一个 <!DOCTYPE html> <html lang="en"> <head> <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="theme-color" content="#000000" /> <meta name="description" content="some cool meta tags" /> <meta content="width=device-width, initial-scale=1" name="viewport" /> <title> Some cool title </title> </head> <body> <div id="root"></div> </body> </html> , build 文件夹。它们都包含与上面提到的相同的 index.html。此外,public 是 public 和 build 文件夹的兄弟。我在本地运行我的应用,它按预期运行。

0 个答案:

没有答案