Why does "ionic serve" roll back .json changes?

Hello there! I’m new to Ionic, so I apologize for the noob-ish question. I’ve been taking a look at some Ionic templates to get familiar with the overall structure of a project, and I’ve been playing/experimenting with them. I like modifying the HTML and CSS on some pages, and see the changes reflected on the app when I run “ionic serve”.

I have a small (and somewhat dumb) question, however. I’ve been playing with an Ionic project I found on Github, which is a simple Point-of-sale application. I noticed that the developers store all of the app’s data in .json files. In this case, I’ve been trying to modify a “products.json” file to try to see the changes reflected when I run the app on a browser.

However, as soon as I run “ionic serve”, everything I modified from that .json file goes back to its previous version, and I’m not sure why. As I said, I’m pretty sure it’s something extremely obvious for you, but I’ve just started learning about this framework, and I was wondering if someone could tell me why does this happen.

Thanks for reading, and I hope you’re all having a wonderful week.

I’m guessing the file you’re modifying lives under the www directory. Don’t touch anything in there; as you’ve observed, changes get blown away. The only place you should be modifying is under src.

1 Like