Cursor Generating Wrong Import Paths
Quick Answer
How do I fix Cursor Generating Wrong Import Paths?
Cursor doesn't know your project's path aliases unless you tell it via .cursorrules or tsconfig.json. Start with "Add import rules to .cursorrules" before making broader code changes.
Fix signals
- What this answers
- Why cursor generating wrong import paths happens and what to change first.
- Fastest move
- Add import rules to .cursorrules
- Use this page if
- Import paths don't resolve
If this keeps happening
Open the next decision, not just the patch
Use these when the current fix is helpful, but the real answer is a better tool choice, a cleaner workflow layer, or a more trustworthy launch path.
Cursor review
Open this when the issue is making you decide whether a more code-first workflow is still the right long-term move.
Open this next →
Lovable reviews
Open this when the bug is making you reconsider whether a faster generated path would reduce the operational overhead.
Open this next →
Deploy hub
Open this when the fix is exposing a broader production handoff problem, not just one bug in the code.
Open this next →
Tool picker
Open this when repeated failures are pushing the decision back up to the stack level.
Open this next →
Firecrawl review
Open this when the app also needs live web data and the bigger stack question is no longer just about the coding tool.
Open this next →
Quick Fix Summary
| Most likely cause | Cursor doesn't know your project's path aliases unless you tell it via .cursorrules or tsconfig.json. |
| Fastest fix | Add import rules to .cursorrules |
| Use this page if | Import paths don't resolve |
You're in the right place if...
- !Import paths don't resolve
- !Uses ../../../ instead of @/
- !Module not found errors
Why this happens
Cursor doesn't know your project's path aliases unless you tell it via .cursorrules or tsconfig.json.
Fix
Add import rules to .cursorrules
Specify your import conventions:
Import alias: @ = ./src
Always use:
import { Button } from '@/components/ui/button'
Never use:
import { Button } from '../../../components/ui/button'Prevent this next time
Include your import alias convention in .cursorrules. Cursor will follow it consistently.
Frequently Asked Questions
A shortcut that means 'start from the src directory'. @ = ./src. Configured in tsconfig.json paths.
../../ paths break when you move files. @ paths always work regardless of file location.
Related fixes
Cursor Not Understanding My Codebase
Cursor Generating Pages Router Instead of App Router
Cursor Using APIs That Don't Exist
Cursor Changing Files I Didn't Ask It To
Cursor Says Context Limit Reached
Cursor Agent Mode Stopping Mid-Task