[FIX-007] Alias Path Resolution Failure
Synchronizing path aliases in both vite.config.ts and tsconfig.json.
PRID: 1117
VERIFIED
1 min read
[FIX-007] Alias Path Resolution Failure (@/)
📝 Problem Background
Using import something from '@/components/...' in the code results in an error, stating the path cannot be resolved.
🧪 Effort Metrics
- Attempt Count: 1
- Time Spent: 10 min
- Complexity: ⭐⭐ (Normal)
🔍 Root Cause Analysis
Browser-native ES Modules do not support non-standard prefixes like @/. This requires synchronized configuration between the build tool (Vite) and the language analysis tool (TypeScript).
🛠️ Fix Strategy
Config Sync Protocol:
- Vite Config: Add
resolve.aliasinvite.config.ts, physically mapping@topath.resolve(__dirname, './'). - TS Config: Synchronously add
"@/*": ["*"]tocompilerOptions.pathsintsconfig.json.
Note: This is an engineering fundamental for maintaining clean imports.