Open trapperhoney opened 1 month ago
I guess this somehow relates to ... #12918
One workaround you don't mention is to ... move the directories to a more ... traditional setup.
OK, looking at fcdc454cc58e9f26ba29389100adfc09cb383448 -- that doesn't actually solve this particular issue.
What version of Hugo are you using (
hugo version
)?v0.135.0+extended
Does this issue reproduce with the latest release?
Yes
Issue
In trying to migrate an existing site to Hugo, I believe I found a bug in the file watcher of the built-in test server.
Direct migration involves a directory structure that does not match the default Hugo directory structure. In particular, content is hosted in the root directory (and subdirectories) while metadata and configuration are stored in a specially named subdirectory under the root, which I'll name
hugo
in this example. The following tree describes this structure and is sufficient to reproduce this issue:This directory structure can be configured with the mounts module in a minimal
hugo.toml
file:When building the site from within the
hugo
directory, everything works as expected. There are no warnings/errors and thepublic
directory is fully populated with the expected content. However, when using thehugo server
command, the process will sometimes bring up the server after many errors, sometimes hang, and sometimes crash. The example output included at the end of this issue seems to imply that the file watcher notices as output is added to the output directory and triggers continuous rebuilds.I believe that the
excludeFiles
option for the mounts module works correctly for excluding content from the content-building system, but does not exclude files from the file watcher in the built-in test server.Workarounds
Including
disableWatch = true
in the mount definition fixes this issue at the expense of disabling automatic rebuilds while the server is running.Alternatively, including a top-level option of
ignoreFiles = ['/hugo/.*$']
seems to fix this issue with configuration redundancy being the only downside. This is a perfectly acceptable workaround for my situation, but I thought I should raise this issue as the include/exclude options in the mounts module seem to be preferred over the globalignoreFiles
option in the project's documentation.Example output (
hugo server
)This particular invocation never terminated.