Cannot find module 'next/link' or its corresponding type declarations.
Unanswered
Transvaal lion posted this in #help-forum
Transvaal lionOP
When setting up a NextJs app in "type": "module" im not able to import the Link component.
3 Replies
Transvaal lionOP
Not sure if the tsconfig.json is of any help, just in case:
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"allowJs": true,
"composite": false,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"incremental": true,
"inlineSources": false,
"isolatedModules": true,
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "esnext"],
"module": "nodenext",
"moduleResolution": "nodenext",
"noEmit": true,
"noEmitOnError": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"plugins": [
{
"name": "next"
}
],
"preserveWatchOutput": true,
"removeComments": true,
"resolveJsonModule": true,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"strictNullChecks": true,
"useUnknownInCatchVariables": true
},
"include": ["next-env.d.ts", "./src/**/*.ts", "./src/**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}You shouldn't add
"type": "module" to package.json, just remove it