I was able to import modules using @ but I upgraded a few components including react and nextjs.
this used to work
import { ValidateProps } from '@/api-lib/constants';
Now getting error:
Module not found: Can't resolve '@/api-lib/constants'
It works if I give it a path
import { ValidateProps } from '../../api-lib/constants';
CodePudding user response:
Personally, I use a jsconfig.json
file. It contains:
{
"compilerOptions": {
"baseUrl": "src"
},
"include": ["src"]
}
Then I am able to import like so:
import Loadable from "components/ui/Loadable";
CodePudding user response:
I just figured I no longer had jsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/api-lib/*": ["api-lib/*"],
}
}
}