Hugo server not watching config of modules since 0.112.0

Hugo 0.112.0 introduced major changes to configuration handling.

I am not sure if there is a regression regarding watching config directories of modules.

I created a minimal test site to illustrate the issue:

git clone --single-branch --branch watch-module-config https://github.com/simonheimlicher/hugo-testing.git  watch-module-config

If I run hugo server as follows with version 0.111.3, it watches the config directories of the included module:

HUGO_MODULE_WORKSPACE=watch-module-config.work hugo@0.111.3 server --disableFastRender
Start building sites …
hugo v0.111.3+extended darwin/arm64 BuildDate=unknown

                   | EN
-------------------+-----
  Pages            |  9
  Paginator pages  |  0
  Non-page files   |  0
  Static files     |  1
  Processed images |  0
  Aliases          |  0
  Sitemaps         |  1
  Cleaned          |  0

Built in 4 ms
Watching for changes in /Users/shz/Resources/Code/hugo-testing/watch-module-config-github/{hugo-project,modules}
Watching for config changes in /Users/shz/Resources/Code/hugo-testing/watch-module-config-github/hugo-project/hugo.yaml, /Users/shz/Resources/Code/hugo-testing/watch-module-config-github/modules/hugo-mwe-theme/config/_default, /Users/shz/Resources/Code/hugo-testing/watch-module-config-github/hugo-project/go.mod, /Users/shz/Resources/Code/hugo-testing/watch-module-config-github/hugo-project/watch-module-config.work
Environment: "development"
Serving pages from memory
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop

Change of config file detected, rebuilding site.
2023-07-30 00:06:00.633 +0200
Rebuilt in 62 ms

However, with any version from 0.112.0 up to 0.115.3, it no longer watches the config directories of modules:

HUGO_MODULE_WORKSPACE=watch-module-config.work hugo server --disableFastRender --port 1314
Watching for changes in /Users/shz/Resources/Code/hugo-testing/watch-module-config-github/{hugo-project,modules}
Watching for config changes in /Users/shz/Resources/Code/hugo-testing/watch-module-config-github/hugo-project/hugo.yaml
Start building sites …
hugo v0.115.4+extended darwin/arm64 BuildDate=unknown


                   | EN
-------------------+-----
  Pages            |  9
  Paginator pages  |  0
  Non-page files   |  0
  Static files     |  1
  Processed images |  0
  Aliases          |  0
  Sitemaps         |  1
  Cleaned          |  0

Built in 6 ms
Environment: "development"
Serving pages from memory
Web Server is available at http://localhost:1314/ (bind address 127.0.0.1)
Press Ctrl+C to stop

What am I doing wrong that this worked in 0.111.3 and stopped working in 0.112.0?

Thanks,
Simon

I am interested where this goes. I experienced the same. I am restarting my hugo server more often these days when I change module configurations :slight_smile: I think the main-idea is that modules configuration won’t change between versions of them. But even with replacements it’s ignored.

Thanks for confirming that you are observing the same issue.

I understand one might assume that config directories change less often.

Following the principle of least astonishment (POLA ), I would still appreciate if it was possible to have the config directories of modules be watched during development.

Hmm … I’m a pretty heavy user of modules myself, so I should have discovered this. I more or less rewrote the config handling in Hugo 0.112.0 – so the timing makes sense …

Watch out for Check watching of module config of modules · Issue #11313 · gohugoio/hugo · GitHub

OK, I have spotted my mistake and have created a PR with a fix (and a test …). I will release a 0.116.1 with a fix for this one tomorrow.

2 Likes

Thanks, I really appreciate your swift action on this. I will be happy to test 0.116.1 and report back.

I have tested this OK in one of my more complex setups, so I’m pretty confident, but please shout if I missed something.

Sorry for the noise.

Again, many thanks for 0.116.1 – as far as I can tell, it perfectly addressess the issue I have observed.

1 Like