Is there a way for VS Code to always use absolute @ paths instead of relative?
Answered
Flammulated Owl posted this in #help-forum
Flammulated OwlOP
import { CourseCard } from '../card'
The above imports break and are hard to manage and nextjs sets us up with the absolute @ path. Is there a way to have VS Code always use @ path resolution when auto importing.
The above imports break and are hard to manage and nextjs sets us up with the absolute @ path. Is there a way to have VS Code always use @ path resolution when auto importing.
Answered by joulev
https://stackoverflow.com/a/53137571
almost the same as the above except you use
almost the same as the above except you use
"absolute"
instead of "relative"
4 Replies
Asian swamp eel
its a tsconfig setting.
{
"compilerOptions": {
...
"paths": {
"@/*": ["./src/*"]
}
...
},
}
Flammulated OwlOP
Thanks! I currently have this
But when VS Code is auto importing it will use "./relative/path"
"paths": {
"@/*": ["./*"],
"@payload-config": ["./app/(payload)/payload.config.ts"]
}
But when VS Code is auto importing it will use "./relative/path"
@Flammulated Owl import { CourseCard } from '../card'
The above imports break and are hard to manage and nextjs sets us up with the absolute @ path. Is there a way to have VS Code always use @ path resolution when auto importing.
https://stackoverflow.com/a/53137571
almost the same as the above except you use
almost the same as the above except you use
"absolute"
instead of "relative"
Answer
Flammulated OwlOP
thank you