Getting Cannot find module '' or its corresponding type declarations.
when importing in Next.js project.
This happens on every single import. Preview
Yarn version : 3.1.0-rc.2
Next version: 11.1.2
tsconfig.json:
{
"compilerOptions": {
"target": "es6",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"experimentalDecorators": true,
"resolveJsonModule": true,
"isolatedModules": true,
"importHelpers": true,
"jsx": "preserve",
// "baseUrl": "src"
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
],
}
If you're using yarn 3 and VSCode, then you need to follow these steps to set up your editor:
yarn dlx @yarnpkg/sdks vscode
TypeScript
filectrl+shift+p
Read here for other editors