Adam
Adam

Reputation: 325

Content not updating with firebase serve --only hosting

I'm trying to test changes to my site. But when I make changes and restart firebase serve --only hosting the changes aren't showing up.

I'm using Vuejs if that matters...

Upvotes: 2

Views: 3319

Answers (4)

Adam
Adam

Reputation: 325

If I use npm run dev I see the content changes immediately with hot reloading. Not sure how npm run dev is different from firebase serve --hosting only or why you need firebase serve at all when developing hosting.

You need to run npm run build before firebase serve --hosting only too. When using firebase serve

The issues seems to be that the emulator hosting doesn't do hot reloading.

Upvotes: 0

codingPerson
codingPerson

Reputation: 109

I had this issue as well. The easiest way of fixing this is to clear cache and cookies, and reload.

Upvotes: 0

karim samir
karim samir

Reputation: 114

i had this problem but it turns out chrome cached my old version and is putting it every time

just disable the cache from chrome from devtools

https://www.technipages.com/google-chrome-how-to-completely-disable-cache

With Chrome, you can have the cache disable when DevTools are open by selecting the "Disable cache" option in the Network tab.

Upvotes: 6

Amanze
Amanze

Reputation: 298

I just do this in the console

npm run build && firebase deploy

(To build into the dist folder AND deploy to firebase hosting)

my firebase.json file looks like this

{
  "hosting": {
    "public": "dist",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  }
}

When all this is done, I log into firebase hosting on the browser, and I delete the previous uploads. Though it will take time for Firebase to update its CDN (probably after 10 minutes), with the new code.

Upvotes: -1

Related Questions