Node fs.watch not working in home asssistant addon

Hi there!

I’m a professional JavaScript/TypeScript developer, so I’ve set myself the challenge to transfer as many of my automations into TypeScript as I can and I’ve started writing an addon for it.

I’m trying to write a setup that runs on a HA Addon, but hot-reloads ‘plugins’ for my addon. This is something that works locally, using a combination of ts-node and the built in node file watcher.

I’ve got this running on an addon. The addon has the config directory mounted inside the cointainer using

map:
  - config:rw

within the config.yaml file.

I’m then looking for a specific ‘plugins’ directory within the config and creating it if it doesn’t exist. All of this works fine when I run it on my local machine, but for some reason fs.watch() doesn’t appear to be noticing changes in the mounted plugins directory when I run it on HA. I’m running the latest version of Home Assistant OS on a Raspberry Pi.

Anyone have any thoughts on what is happening here would be much appreciated.