Plugin release for developers: Hot-reload the plugin(s) you're developing

(posted on Developers and API since this plugin is only useful for developers)

I made this for me, but thought other developers might find it useful:

What it does is that if you have a plugin with a .git directory or a .hotreload file in it, then it will be automatically watched for changes to the main.js or styles.css, and after a debounce period, the target plugin will be reloaded in Obsidian (by first disabling and then re-enabling it).

So instead of having to keep reloading Obsidian or toggling your plugins manually, you can just save and/or rebuild your plugin, and have the update in Obsidian almost instantly.

To install the plugin, just clone the repo (or unpack the .zip release) into your vault’s plugins directory. Then activate it from the “Community Plugins” tab, like any other plugin.



Thank you, thank you, thank you. Such a good idea – I didn’t know I needed this but I’m glad I have it now :slight_smile:

A few things I stumbled over: I didn’t grasp this is itself a plugin that needs to be installed and activated - Here’s what I did:

  1. I downloaded the .zip
  2. moved it to ./plugins
  3. did a test edit in one of my plugins
  4. waited for something to happen (nothing happened)
  5. moved the files from inside the folder to ./plugins (nothing happened)

Here I thought I couldn’t use it with me set-up and was about to abort.

Only by chance did I check my list of plugins and then toggled it on.

My suggestion:

Add a step-by-step installation/activation instructions in your post and on the repository:

How to install this plugin

  1. Download .zip from releases
  2. Extract zip
  3. Move folder to ./plugins
  4. Activate the plugin in your list

And a tip that’s working well for me right now:

I’ve added a notice at the bottom of the main.js of what I’m working on:

new Notice("Journey Re-Loaded!");

So I know exactly when I can start testing again.

Hope this helps!


Good ideas! The plugin and its readme have been updated. The plugin now posts a Notice about the reload, so you don’t have to do it in your plugin anymore.

Thanks a lot, this is going to be really helpful!

I’m very new to this, it seems that the handler is only fired on changes to config and workspace files within .obsidian directory, so changes in .obsidian/plugins are not monitored. Could you point me to what I’m missing?

It seems that the handler is only fired on changes to config and workspace files

What makes you say that?

I’ve added a console.log(filename); statement as first line in onFileChange to understand what was happening, and then tried to edit and create new files within the vault, both in the main directory, directly in .obsidian directory and in its subfolders - it worked fine for main vault directory, but within .obsidian only config and workspace files got logged.

What platform are you on? Mac, Linux, Windows?

Running from snap on Linux

Ah. That makes sense, actually; I recently found out that on Linux, Obsidian doesn’t do a recursive directory watch: it starts a new watch for each subfolder explicitly. Which kinda sucks because even if hot-reload were to start a watch for /plugins, it would also have to do it for every folder as well.

I’ve updated the plugin (0.1.4) to add Linux support: give it a try and let me know how it works!

1 Like

Works perfectly! Thanks so much!

Actually, it won’t detect that you’ve created a new plugin unless something triggers it on an old plugin. It also won’t detect when a plugin becomes hot-reloadable. So I’m adding some more code to fix those cases.

1 Like

Ok, it should be available as 0.1.5 now.

this works like a charm! thank you

Awesome work!

This is so useful! thanks @pjeby !

This plugin seems interesting, and I will try it now. Just one thing came to my mind, even though this is only meant for developers, could you make it available via the normal community plugin search in Obsidian? You could write something like “FOR DEVELOPERS ONLY” in the description field. :slight_smile:

1 Like

Just putting my thanks here for this super helpful plugin!