-
Notifications
You must be signed in to change notification settings - Fork 26k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update module-path-aliases.md #43592
Conversation
@@ -93,3 +93,35 @@ export default function HomePage() { | |||
) | |||
} | |||
``` | |||
|
|||
The additional `paths` are reletive to the `baseUrl`. For example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The additional `paths` are reletive to the `baseUrl`. For example: | |
The additional `paths` are relative to the `baseUrl`. For example: |
"paths": { | ||
"@styles/*": ["../styles/*"], | ||
"~/*": ["../*"], | ||
"/*": ["../../*"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this example may cause confusion as baseUrl
shouldn't really be used in this way and more so should point to the packages base. Potentially it could show a nested package as the baseUrl
and including shared utils in paths?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh ohk. I am pretty new to NextJS, so I was not aware this is a bad practice. It does seem to be working in my project, but I think we could just remove this example.
I do think that it would still be helpful to mention that the paths will start at the baseUrl location instead of the root.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sounds good to keep just the note and maybe strip the example 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I have removed the example and also added a commit with a better example in case you want to include one.
e078ebe
to
6b863fe
Compare
@@ -93,3 +93,35 @@ export default function HomePage() { | |||
) | |||
} | |||
``` | |||
|
|||
Each of the `"paths"` are reletive to the `baseUrl` location. For example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each of the `"paths"` are reletive to the `baseUrl` location. For example: | |
Each of the `"paths"` are relative to the `baseUrl` location. For example: |
# Conflicts: # docs/advanced-features/module-path-aliases.md
Bug
fixes #number
contributing.md
Feature
fixes #number
contributing.md
Documentation / Examples
pnpm build && pnpm lint