Open CamilleScholtz opened 1 year ago
Ran into the same issue for my site using hugo v0.115.3+extended darwin/arm64 BuildDate=unknown
It appeared to be triggered by VSCode constantly touching the files with a git status -z -uall
command. Here is the output from the hugo serve
. The rebuild times continue to get longer and longer until the CPU is at %100.
Change detected, rebuilding site.
2023-07-20 10:20:48.595 -0600
WARN .File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }}
Rebuilt in 663 ms
Change detected, rebuilding site.
2023-07-20 10:20:55.096 -0600
WARN .File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }}
Rebuilt in 607 ms
Change detected, rebuilding site.
2023-07-20 10:21:01.095 -0600
WARN .File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }}
Rebuilt in 634 ms
Change detected, rebuilding site.
2023-07-20 10:21:07.095 -0600
WARN .File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }}
Rebuilt in 631 ms
Change detected, rebuilding site.
2023-07-20 10:21:13.096 -0600
WARN .File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }}
Rebuilt in 698 ms
Change detected, rebuilding site.
2023-07-20 10:21:19.095 -0600
WARN .File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }}
Rebuilt in 749 ms
Change detected, rebuilding site.
2023-07-20 10:21:25.095 -0600
WARN .File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }}
Rebuilt in 788 ms
Setting the following setting seems to be a workaround:
[build]
noJSConfigInAssets = true
VSCode constantly touching the files with a git status -z -uall command.
I have never experienced anything like this with VSCode.
If you keep changing a file that Hugo watches, you will get repeated builds. There are ways to get around the described case above, but this also smells like a defect in VSCode.
In my case, I think visual studio code was triggering it when there was a large number of staged files, some of them application generated and not just code or markdown... causing the diff to be extra large. Anyways, outside of VSCode on the command line, it's not an issue and in VSCode as long as I'm not staging a bunch of files, it's also not an issue.
For some added context, this is on my VPS, where I am not running an editor such as VSCode. I am running hugo
with the flags -w --quiet -s /srv/reactionair.nl
and I am running the webserver Caddy, though as far as I know I am not running any kind of file watcher that would interact with or even touch jsconfig.json
.
See the title, a
hugo —watch
update results in an endless loop that consumes 100% CPU. Running debug it prints the following endlessly: