构建 React.js 应用程序时出现空白页

Getting Blank Page when building React.js App

我昨天开始使用 React.js 并想制作我的小应用程序 public(我知道这通常是个坏主意)。但是,我有一个问题,每当我想构建静态HTML 个带有“npm 运行 构建”的文件,我只得到默认的 index.html,没有任何 React.js 组件。

正如我所说,我从昨天开始才开始使用 React,这可能就是我犯一些非常愚蠢的错误的原因 :D

这是我的 package.json:

{
  "name": "playground",
  "version": "0.1.0",
  "private": true,
  "homepage": "I placed the URL and port here",
  "dependencies": {
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "4.0.3",
    "web-vitals": "^1.1.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

好的,我创建了一个新的 React-APP 并复制了我的代码。现在它开始工作了,虽然我不知道它为什么工作 xD