title: How to deploy React build folder to Heroku
body: <p> I looked around the internet for this and found <a href="https://medium.com/quick-code/deploying-production-build-of-react-app-to-heroku-2548d8bf6936" rel="nofollow noreferrer">this medium article</a> using serve. The article directed modifying the packange.json file to this:</p>
  
  <pre><code>"scripts": { 
    "dev": "react-scripts 
    "start", "start": "serve -s build", 
    "build": "react-scripts build", 
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject", 
    "heroku-postbuild": "npm run build" 
  },
  </code></pre>
  
  <p>Now this works in development. I get console logs saying Content is cached for offline use. And google Lighthouse gives me >90% on progessive web apps. The problem is, when I deploy to Heroku, during build it runs the npm run build specified in the package.json scripts. But on opening the app, I get 21% on performance, and 50% on progressive web apps in firehouse. Also, it says service worker not registered. Which means it is not serving from the build folder. As an extra, I ran npm build myself in development machine and deployed the project TOGETHER with the build folder, but still same result. Now I also came around <a href="https://medium.com/jeremy-gottfrieds-tech-blog/tutorial-how-to-deploy-a-production-react-app-to-heroku-c4831dfcfa08" rel="nofollow noreferrer">this other article</a>suggesting to use node.js server and change scripts in package.json to this:</p>
  
  <pre><code>start: "node server.js"
  </code></pre>
  
  <p>I no nothing about node.js, so I decided to consult here for better choices.</p>
  
  <p>EDIT: If a server command is needed, like in the node.js in the second medium article, and in Garesh's php code below - if anyone could help with a similar code in python(django), it'd be nice</p>