Nextjs Tips Series: Absolute import and alias

NextJs has better support for absolute imports and aliases. It is now possible to set a baseUrl in jsconfig.json. This file also has support for paths now.

// tsconfig.json or jsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/ui/*": ["components/*"]
}
}
}
// Imports 'components/ui/input'
import Input from '@/ui/input'

Thank you :)