Skip to content

Instantly share code, notes, and snippets.

View mawjaljadirjy's full-sized avatar
🙂

Mawj M.Basheer mawjaljadirjy

🙂
View GitHub Profile
@ihollander
ihollander / VSCode-live-server-setup.md
Last active July 13, 2024 17:46
Setup instructions for Live Server in VSCode (how to prevent issues working with json-server)

Problem Statement

Live Server is a great tool for working with Javscript. It automatically reloads our code any time changes are made to files in the folder where Live Server is running. This becomes an issue when using a tool like json-server with a .json file in the same directory - since changes you make using POST/PATCH/DELETE requests will update the .json file, these changes will also cause your app to reload.

Solution

You can solve this by telling Live Server to ignore changes to certain files. Open your VSCode preferences by pressing command + shift + p in VSCode and searching for "Preferences: Open Settings (JSON)". Then, add the following lines to the settings.json file:

"liveServer.settings.ignoreFiles": [