Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying a Firebase app breaks before refresh

Whenever I deploy my Firebase app for hosting that is a packaged Create-React-App then the first time the browser loads it the console shows:

main.27e9b1c2.js:1 Uncaught SyntaxError: Unexpected token <

F5 refresh fixes it. Then the site is working perfectly until the next time I deploy.

I am using firebase hosting and firebase tools to deploy. The number on the mainjs is the current build.

like image 238
arisalexis Avatar asked Oct 06 '18 10:10

arisalexis


1 Answers

you can disable cache in firebase.json

"headers": [
    {
      "source": "/service-worker.js",
      "headers": [{ "key": "Cache-Control", "value": "no-cache" }]
    }
  }
like image 166
arisalexis Avatar answered Sep 30 '22 16:09

arisalexis