Learn how to fix broken imports from Cursor with simple steps that restore smooth workflow, improve code reliability, and prevent errors.

Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
When Cursor “breaks your imports,” the fastest real fix is to manually verify your import paths and file structure yourself, then use Cursor only to assist, not to assume it’s right. Cursor can rewrite imports incorrectly because it doesn’t always know your folder layout or TypeScript/Node/Python resolution rules. The fix is always the same: check the real file paths on disk, confirm the correct relative or absolute import style, adjust tsconfig / webpack / Python path settings if needed, and then run your project locally to verify. Treat Cursor like an assistant that proposes changes, not an authority that edits blindly.
Sometimes Cursor “thinks” a file lives in a different folder, or it rewrites imports to be shorter/cleaner but ignores your real project settings. It also can hallucinate that certain alias paths exist (like @/utils) even if your tsconfig.json doesn’t define them or your bundler doesn’t support them.
This is the exact process senior devs follow so imports don’t break whenever Cursor edits multiple files.
npm run dev, node index.js, python app.py). The terminal is the truth — it shows real errors.Error: Cannot find module '../utils/formatDate'
helpers, not utils.// Incorrect (what Cursor sometimes writes)
import formatDate from '../utils/formatDate'
// Correct (matches real folder on disk)
import formatDate from '../helpers/formatDate.js'
@/components), verify they actually exist in tsconfig.json:{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"] // Must match actual folder!
}
}
}
**init**.py or that you’re running the script from the correct location so relative imports work.# Correct Python import if structure is:
# app/
# utils/
# __init__.py
# math_tools.py
from app.utils.math_tools import calculate
../utils/formatDate to ../helpers/formatDate.js.” Cursor can then apply that consistently.
These habits eliminate 90% of future pain.
tsconfig.json or Python project structure so Cursor can’t guess incorrectly.
If Cursor rewrote this:
import { calculateTotal } from '@/lib/math'
But your project actually has:
src/utils/math.js
The correct import is:
import { calculateTotal } from '../utils/math.js'
Or, if you want aliases:
// tsconfig.json
{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@/*": ["*"]
}
}
}
Then your original alias import becomes valid.
The real fix is always the same: trust your filesystem and runtime errors, not Cursor’s guesses. Use Cursor to help you make consistent changes only after you’ve confirmed what the correct import should be.
This prompt helps an AI assistant understand your setup and guide you through the fix step by step, without assuming technical knowledge.
When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.