I'm struggling with Next.js project I'm working on using VSCode.
It is based on simple npx create-next-app
I'm writing a component (page) and of course need to use react hooks like useState
Before in my previous react projects (not nextjs), after hitting ctrl+space just after useState
vscode was suggesting adding correct import from "react"
. Now it adds it like import { useRef, useState } from "react/cjs/react.production.min";
and it doesn't work...
I think it may be somehow related to .jsconfig
file that I added to have absolute imports
"compilerOptions": {
"baseUrl": "."
}
}
Before I added it, it was ok. But unfortunately even if I delete .jsconfig
the problem is still there...
How to fix it AND have absolute imports available?
The other issue is that in React projects VSCode was automatically underlining missing imports. In NextJS it does not. It's so annoying to look for all the imports that are missing, especially when copy-pasting a larger part of code.
I would highly appreciate any help with this! Thank you in advance!
.jsconfig
file empty it indeed autosuggests correct imports. But I would like to have the absolute imports. – Stereobate