[Typescript] Absolute paths point to page directory when dynamically importing file #16885
Unanswered
marcopixel
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Not sure if this is the right place, but i'll assumed it's an issue with the way Next.js transforms the tsconfig.json paths to webpack aliases.
So my issue is that i'm unable to map my paths if it's used inside a dynamic import. When i'm doing it inside a dynamic import, it will resolve it into the relative folder of the page/function on where it's used.
As an example, here's my current setup:
Repo: https://github.com/marcopixel/absolute-import-repro
pages/games/[id].tsx
tsconfig.json
This will produce the following error:
If i either use the example with the root folder as shown inside the docs like this
or as a complete static import but with the correct alias
it will just work fine, so i'm thinking there's some sort of error when converting the paths to webpack aliases.
Any help would be appreciated, even if it's only a small issue 👍
Beta Was this translation helpful? Give feedback.
All reactions