Sorry to bring up again this topic. I got some time today and tried to change my setup.
I read again the replies of this thread, and I thought that I might not have explained clearly my situation.
Let’s say that I have the following folder structure:
assets/someModule
└───src
│ MainClass.tsx
│
├───components
│ ├───Component 1
│ │ index.tsx
│ │
│ ├───Component 2
│ │ │ index.tsx
│ │ │
│ │ ├───Component 2.1
│ │ │ index.tsx
│ │ │
│ │ └───Component 2.2
│ │ index.tsx
│
└───utils
util1.ts
And I would like to import MainClass.tsx
inside Component 2.2/index.tsx
. Currently, it’s possible to do:
import MainClass from '../../../MainClass.tsx'
But by using tsconfig.json
, defining path
property, I was able to import that file using the following syntax, which I think could be more clear and easy to write:
import MainClass from '~/MainClass.tsx'
Does Hugo have currently this kind of mechanism? Like redefining paths only for specific modules. In this case, ~
is only applied for files under assets/someModule
, and by writing ~
, it resolves to some specific path of module, like assets/someModule/src/*
Edit: mechanism to avoid relative-path hell is what I meant to say.
Thanks in advance.