Cursor·Fixpromptingbeginner

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.

Quick Fix Summary

Most likely causeCursor doesn't know your project's path aliases unless you tell it via .cursorrules or tsconfig.json.
Fastest fixAdd import rules to .cursorrules
Use this page ifImport 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

1

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