Open nancheal opened 5 months ago
When you say you downloaded the sample plugin, did you do a git clone to the .obsidian/plugins subdirectory? If not, you'll need to add a .hotreload file. Also, sometimes when you start developing a new plugin, you need to manually disable hot reload itself and re-enable it. But mainly, see the README:
this plugin automatically watches for changes to the
main.js
orstyles.css
of any plugin whose directory includes a.git
subdirectory or a file called.hotreload
, and then automatically disables and re-enables that plugin once changes have stopped for about three-quarters of a second
Notice that in addition to the parts about .git and .hotreload, it says it watches for changes to main .js, not main .ts. If you are working on a plugin in TypeScript, you need to build it to create a main.js in the right location, which requires tools other than hot-reload. Hot Reload assumes you already have the necessary build tools to rebuild your plugin's main.js in the .obsidian/plugins directory of your test vault -- all it does is reload the plugin after main.js changes.
I assume, if enabling and disabling actually works, that you do have build tools running to do that updating, but just thought I should point that out in case it's an issue of not updating main.js. If your build tools are doing that then the most likely next issue is not having a .hotreload file (which is what tells Hot Reload that you want to watch the plugin for changes -- it doesn't watch every plugin because then if you download an update to a plugin you're not working on, it would end up double-reloading.)
I downloaded hot-reload and sample-plugin, and then modified the code of main.ts of sample-plugin. I still need to manually open and close sample-plugin for the changes to take effect. Do I need to configure anything else?