An Interest In:
Web News this Week
- March 21, 2024
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
- March 15, 2024
December 18, 2021 05:31 am GMT
Original Link: https://dev.to/avxkim/path-aliases-in-nextjs-4pio
Path aliases in Nextjs
Tired of writing such imports?
import test from '../../../components/Test.tsx';
If you're using a typescript, you can create a path alias instead:
{ "compilerOptions": { "baseUrl": "src", "paths": { "@/*": ["./*"] } }}
Then you can import more conveniently:
import test from '@/components/Test.tsx';
Don't forget to restart your running task to affect changes.
Original Link: https://dev.to/avxkim/path-aliases-in-nextjs-4pio
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To