Search code examples
reactjsbuild

Getting Blank Page when building React.js App


I started using React.js yesterday and wanted to make my little app public (I know that's usually a bad Idea).However, I have the problem that whenever I want to build the static HTML files with "npm run build", I only get the default index.html, without any React.js components.

As I said, I've only been with React since yesterday, which is probably why I'm making some very stupid mistake :D

Heres my 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"
    ]
  }
}

Solution

  • Ok, I created a new React-APP and copyed my code. Now its working, although I have no clue on why its Working xD