11ty / eleventy-dev-server

A minimal generic web-development web server.
103 stars 19 forks source link

A file watched with setServerOptions does not trigger a reload. #73

Closed edwardhorsford closed 10 months ago

edwardhorsford commented 10 months ago

I've told the eleventy dev server to watch a specific file like so:

eleventyConfig.setServerOptions({
      watch: [
        'lib/data/siteImages.yaml' // doesn't work - can't read from this location?
      ]
    })

When this file is saved, I expect and would like Eleventy to rebuild my site. Instead I see this in the console:

Eleventy:Logger File changed: lib/data/siteImages.yaml (skips build)

This implies I've given it the right watch target (I didn't see this message before adding it), but for some reason despite being told to watch this, it's not triggering a reload.

My guess would be that Eleventy doesn't think this file is used by my site, and so is trying to be smart about not reloading. However my assumption was that any file or set of files explicitly added with the watch method would force the reload.

edwardhorsford commented 10 months ago

Hmm, this might be a partial misunderstanding on my part - I perhaps want addWatchTarget to trigger a rebuild. I've tested that and it seems to work.

However it still feels unexpected that items added to watch explicitly don't trigger a reload.

edwardhorsford commented 10 months ago

Nevermind, it seems it was reloading, I just didn't realise.

I think this was a combination of it being too fast, and the logged message including (skips build) which made me think nothing was happening.