You are using an unsupported browser. Please update your browser to the latest version on or before July 31, 2020.
Home > FAQ > Can I change which files cause my app to restart?
Can I change which files cause my app to restart?
print icon

If your project is a static site, like a simple webpageyou can't designate which files will cause your app to restart.  However, you can toggle off the Refresh App on Changes option to prevent the project editor from automatically updating the app whenever changes are made.

  • You can find this option in the project editor by clicking the little down arrow to the right of the project name.  This will open the project options menu.
  • In the project options menu, scroll down until you see the Refresh App on Changes option and give it a click to toggle off.


If your project is a full-stack or generated static site, you can add a file called watch.json to your app, and the settings it contains will override the default install and restart trigger files and timings.


In a watch.json you can specify:

  • Which files trigger a container install or restart when edited.
  • The delay-time between making edits and those changes being applied.


Here is an example of code that might appear in a watch.json :


  "install": {
    "include": [
  "restart": {
    "exclude": [
    "include": [
  "throttle": 100


Click here to see an example of a project that disables auto-restart entirely.


Configuring a watch.json

There are three top-level keys that you can use to configure a watch.json:

  1. restart
  2. install
  3. throttle


restart determines which files will cause Glitch to terminate the server and re-run the start command. You can select which files will trigger a restart by choosing which files to explicitly include or exclude. Both include and exclude are an array of regular expression patterns that match file paths in the project's code

  • "^package\\.json$" selects a package.json file at the root of the project
  • "\\.js$" will match any file ending in .js in the project
  • ^dist/ is a folder called dist in the root of the project


install determines which files will cause Glitch to terminate the server, run the install command, and run start again. install takes the same include and exclude arrays as restart.


throttle lets you change how long the watcher waits to restart after it sees a change.

  • The value is the number of milliseconds to wait after a change to restart


For more information, check out the Glitch project: watch-json.

Got more questions? Check out our Community Forum!
Open 24/7, the forum is where Glitch makers help each other and show off all the rad apps that they have created. It's the friendliest community of coders on the Web!
3 out of 7 found this helpful

scroll to top icon