paths trong tsconfig.json map import paths để tránh relative paths dài.
Cần configure cả bundler vì TS compiler chỉ handle types, không transform imports.
json
// tsconfig.json
{ "compilerOptions": { "paths": { "@/*": ["./src/*"] } } }typescript
// vite.config.ts
import { defineConfig } from 'vite';
export default defineConfig({
resolve: { alias: { '@': '/src' } }
});
// Dùng: import { Button } from '@/components/Button'