Search code examples
javascriptreactjsfirebasefirebase-hosting

I accidentally overwrote my build folder trying to create a dev server in firebase


I have an existing project in Firebase that is already in production (a React web app) but I'm in the process of trying to create a dev server. I created another project then proceeded with the steps in the CLI as I figured they were appropriate:

firebase use bizzy-book-dev
firebase init      
firebase deploy --only hosting 

The dev site wasn't displaying so I checked the firebase dev project and it showed I only had 8 files in the release history (I should have 48...):

enter image description here

I couldn't get it to work so I decided to try at a later date. When I switched back to my production project, made changes and deployed, I noticed that whatever I did earlier affected my main project. I've rolled back so my site is live but I'm stuck not being able to make updates.

enter image description here

I have two questions:

  1. How do I fix this build issue?
  2. How do I get a dev server up when I have an existing firebase project?

Solution

  • I am not sure about your specific project layout, provide a sample public project so it gets easier to advise you.

    Besides that, where you using just hosting or any other firebase service?

    For instance, you might have changed something on your firebase.json regarding the public folder configuration. Docs says that it might happen if you call firebase init twice.

    Besides that, take a look at the emulators, they might help a lot when you want to test something but don't want to publish your changes every single time you tweak something. I am studying firebase too and so far they help to test several concepts and enhance productivity for solutions using firebase as platform. Give them a try!