Skip to content
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

Merged
merged 5 commits into from
Jun 14, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 32 additions & 0 deletions docs/advanced-features/module-path-aliases.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,35 @@ export default function HomePage() {
)
}
```

Each of the `"paths"` are reletive to the `baseUrl` location. For example:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Each of the `"paths"` are reletive to the `baseUrl` location. For example:
Each of the `"paths"` are relative to the `baseUrl` location. For example:



```json
// tsconfig.json or jsconfig.json
{
"compilerOptions": {
"baseUrl": "src/",
"paths": {
"@/styles/*": ["styles/*"],
"@/components/*": ["components/*"]
},
}
}
```

```jsx
// pages/index.js
import Button from '@/components/button';
import '@/styles/styles.css';
import Helper from 'utils/helper';

export default function HomePage() {
return (
<Helper>
<h1>Hello World</h1>
<Button />
</Helper>
)
}
```