Option to ignore unused symlinks?

I currently having an issue related to symlinks, bu actually I can’t really understand why - it’s not used or read by Hugo (at least not on purpose). It’s just sitting in a theme directory.

Certainly I’m just not able to formulate a specific query, but in my theme I have a package.hugo.json but can’t get yarn to just work with this file. It always tries package.json. If it can’t find it it uses the one from a parent directory, which is the one for the site. Using --cwd one can limit this behaviour but since the name isn’t package.json. The obvious solution is a symlink: ln -s package.hugo.json package.json

But this breaks Hugo:
Error: add site dependencies: create deps: create PathSpec: build filesystems: create main fs: symlinks not allowed in this filesystem

I could understand this, if hugo server would report this due to the watcher, but I can’t see any reason why a normal build even checks this file…

Am I missing something here, would using NPM instead of Yarn provide a workaround?

I think a more obvious solution would be

cp package.hugo.json package.json

I’m sorry, how is this a solution? Now changes aren’t picked up by hugo mod npm pack anymore…

I’m not totally sure I understand your setup, and “cp command” should maybe be the other way around, but my main point is:

  • Hugo does not follow symbolic links in theme/components – I suspect your error comes from package.hugo.json being a symlink
  • But I don’t see how these files should need to be updated very often, so doing a copy to keep them in sync should be manageable.

Or, that’s your current option.

Your assumption is right - it’s just this link. And that’s the reason why I was asking, neither should Hugo check this file nor is it pointing outside of the directory of the specific theme…

Anyways, I consider using cp a workaround, not a solution.

Since this isn’t my first problem with the experimantel hugo mod npm pack (the other being 8319) I’ll stop trying to keep my theme compatible with this mechanism. How about some sort of an umbrella issue on GitHub to collect possible improvements to hugo mod npm pack?

Thanks for looking into his!

If Hugo didn’t check this file, then hugo npm pack would not work as expected. I’m not sure what you mean by “unused symlink”?

That’s right, but Hugo also complains if I don’t run hugo mod npm pack. The symlink shouldn’t be used when running just hugo

OK, so that sounds like a bug … But I do suspect that you have another symlinks in, e.g. /static. Could you create a GitHub issue?

Yes, but it might take some time since I want to restructure my example repository (for #8370) first…