Thanks for the reply, Joe.
Let me elaborate.
I have a monorepo, where my Hugo frontend project resides in the same repository as my TypeScript backend.
I’ve made the backend a Go module so that it can be used as a Hugo module. It works with this hugo.yaml
configuration:
module:
replacements: "github.com/user/project/backend -> ../../backend"
imports:
- path: github.com/user/project/backend
mounts:
- source: src
target: assets/backend
The motive behind this configuration is that I can have import statements in my frontend TypeScript files that look like this:
import { backendReponseType } from "backend/controller.ts";
instead of this:
import { backendReponseType } from "../../../../../backend/src/controllers/payment";
The problem with this configuration, however, is that VSCode doesn’t recognize this as a valid import.
See this screenshot to see what I mean:
The console.log
statement works correctly and properly prints out the correct value of x
, but I no longer have any TypeScript hints in VSCode.
The issue I’m trying to resolve here is related to the post below which talks about enabling path aliases for Hugo.
Hope this helps clear things up.