hugo icon indicating copy to clipboard operation
hugo copied to clipboard

hugo mod vendor doesn't work for modules that only import other modules

Open writeonlycode opened this issue 2 years ago • 1 comments

Sometimes it's useful to create modules that just packages a GitHub repository. For example: I was trying to create a Hugo Module that just packages Splide JS repository:

[module]
[module.hugoVersion]
extended = true
[[module.imports]]
path="github.com/splidejs/splide"
[[module.imports.mounts]]
source = "dist"
target = "assets/splide"

That works fine: the module doesn't have any files, it just imports some files from somewhere else. The problem: when I use this module, and try to vendorize it, Hugo complains that the module doesn't have any mounts. That's bad, because now I can't vendozire the repository that's getting imported through the module...

This isn't super bad, and can be solved somewhat easily: I just have to include some random file in the module and mount it. But it would be nice if we didn't need this hack to get the module vendorized...

I suspect that this either an intended behavior, or it's at least a go issue, but maybe it's possible to solve on Hugo's side... Not sure.

writeonlycode avatar Jul 26 '22 09:07 writeonlycode

Yea, we should try to to fix this. I guess this is the reason why I created this at some point in time:

https://github.com/bep/empty-hugo-module

bep avatar Jul 26 '22 11:07 bep