Cannot find name 'defineNuxtConfig'.ts(2304)
Full error message
I tried to install Nuxt 3 layers inside a monorepo with turborepo. and I somehow get error with typescript where it's seems to not able to figure out nuxt
defineNuxtConfig not find
appConfig not found
the ts config file look like this:
{
"extends": "./.playground/.nuxt/tsconfig.json"
}
and on .playground/.nuxt folder there's tsconfig that look like this(auto-generated):
// Generated by nuxi
{
"compilerOptions": {
"forceConsistentCasingInFileNames": true,
"jsx": "preserve",
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Node",
"skipLibCheck": true,
"strict": true,
"allowJs": true,
"noEmit": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"types": [
"node"
],
"baseUrl": "..",
"paths": {
"~": [
"."
],
"~/*": [
"./*"
],
"@": [
"."
],
"@/*": [
"./*"
],
"~~": [
"."
],
"~~/*": [
"./*"
],
"@@": [
"."
],
"@@/*": [
"./*"
],
"assets": [
"assets"
],
"public": [
"public"
],
"#app": [
"../../../node_modules/nuxt/dist/app"
],
"#app/*": [
"../../../node_modules/nuxt/dist/app/*"
],
"vue-demi": [
"../../../node_modules/nuxt/dist/app/compat/vue-demi"
],
"@vueuse/head": [
"../../../node_modules/@unhead/vue/dist/index"
],
"#imports": [
".nuxt/imports"
],
"#build": [
".nuxt"
],
"#build/*": [
".nuxt/*"
],
"#components": [
".nuxt/components"
]
}
},
"include": [
"./nuxt.d.ts",
"../**/*"
],
"exclude": [
"../dist",
"../.output"
]
}
how can i fix this so that defineNuxtConfig is recognized properly?
remove error Cannot find name 'defineNuxtConfig'.ts(2304)Solutionsource: stackoverflow \u2197
I had the same problem, weirdly enough after trying a few things what fixed it for me was changing the VSCode plugin Volar:Typescript Version to Use workspace version THEN changing back to Use VS Code's Version How: On VSCode press F1 or Ctrl + Shift + P Type Volar: Select Typescript Version Select Use workspace version Repeat steps 1 & 2 But this time select Use VS Code's Version Bam, all my nuxt3 autoimports are correctly typed, don't know why tho.
API access
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/0c651b84ab4d7677931dc610457d8e26c4247e89357737d42c3fdd1a42b4b00dhash \u00b7 0c651b84ab4d7677931dc610457d8e26c4247e89357737d42c3fdd1a42b4b00d