How to do hugo >= 0.77 module.replacements with nested modules right

nested modules are working fine on this tiny example site, but module.replacements does not:

This site is importing github.com/regisphilibert/hugo-module-icons
The only page it offers is: /hugo-icons-listing from regisphiliberts module.

I then planed to adjust the layout:

  1. downloading the “hugo-module-icons” next to my “icons-test-site”
  2. in icons-test-site/config.toml I set replacements = ‘github com regisphilibert hugo-module-icons → …\hugo-module-icons’

This breaks hugo server -D and hugo with
Error: module "github.com twbs icons" not found;

this is an import from regisphiliberts module.

Where does this error need to be fixed and how?

This may be related to:
https://github.com/gohugoio/hugo/issues/8072

I was able to make your setup work by using the replace directive with your project’s go.mod file, instead of using module.replacements within your project’s configuration file.

module github.com/dkipp/icons-test-site

go 1.16

replace github.com/regisphilibert/hugo-module-icons => ../hugo-module-icons

require (
	github.com/regisphilibert/hugo-module-icons v0.0.0-20200905140323-ee1ee22c0d75 // indirect
	github.com/twbs/icons v1.5.0 // indirect
)

Tank you, that works for me too.
I still hope this gets fixed soon. I see a huge advantage to handle this in config files if used in conjunction with environment specific configuration-directories.