gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
76.14k stars 7.54k forks source link

Module replacements not able to resolve nested modules #9494

Open UtkarshVerma opened 2 years ago

UtkarshVerma commented 2 years ago

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.92.2+extended linux/amd64 BuildDate=unknown

Does this issue reproduce with the latest release?

Yes

The issue

I have the following in my config.yaml.

module:
  replacements:
    - github.com/UtkarshVerma/hugo-yoru -> ../../hugo-yoru
  imports:
    - path: github.com/UtkarshVerma/hugo-yoru

Now, the hugo-yoru module depends on FontAwesome. When I run Hugo server, I get the following error:

Error: module "github.com/FortAwesome/Font-Awesome" not found; either add it as a Hugo Module or store it in "/home/subaru/GitHub/bitbanged.com/themes".: module does not exist

Thanks in advance.

bep commented 2 years ago

This is a limitation of replacements, I'm afraid, and not something I think that's easily solvable. The replacements just replaces the path value, nothing else.

I would suggest that you use the replace directive in go.mod. Note that all of this will (hopefully) be much improved in a month or so with Go 1.18's workspaces.