0

I am new to react.js and trying to convert my websites content into react components as a way to learn it with friends. I am using npx create-react-app and want to put the app online with Google Firebase. The deploying was successful - but I could not see the localhost page with the components I am seeing when I run npm start. Instead there is an empty page.

I followed some online guides and run npm run build.

Than, I tried to add "homepage:" to package.json and set it as "mydomain.com" or ".".

I have also changed my Firebase public directory to the build folder (instead of public).

Nothing yet worked. does anyone has an idea why?

  • 1
    Have you looked at the official documentation? https://create-react-app.dev/docs/deployment/#firebase – goto Jul 01 '20 at 11:06
  • Thanks mate! This was one of the guides I followed, but turns out I did not fixed issue #2440: setting out "social worker" for first deployment. Now it is working. –  Jul 01 '20 at 11:38

1 Answers1

0

Thanks to goto1 I looked again in react documentations and found out about issue #2440. Adding:

"headers": [
  {"source": "/service-worker.js", "headers": [{"key": "Cache-Control", "value": "no-cache"}]}
]

in firebase.json solved it for me.

See more at: https://create-react-app.dev/docs/deployment/#firebase