Nuxt automatically generates multiple TypeScript configuration files (.nuxt/tsconfig.app.json, .nuxt/tsconfig.server.json, .nuxt/tsconfig.node.json and .nuxt/tsconfig.shared.json) that include recommended basic TypeScript configuration for your project, references to auto-imports, API route types, path aliases, and more.
Your Nuxt project should include the following tsconfig.json file at the root of the project:
{
"files": [],
"references": [
{
"path": "./.nuxt/tsconfig.app.json"
},
{
"path": "./.nuxt/tsconfig.server.json"
},
{
"path": "./.nuxt/tsconfig.shared.json"
},
{
"path": "./.nuxt/tsconfig.node.json"
}
]
}
nuxt.config.ts.You can customize the TypeScript configuration of your Nuxt project for each context (app, shared, node, and server) in the nuxt.config.ts file.
export default defineNuxtConfig({
typescript: {
// customize tsconfig.app.json
tsConfig: {
// ...
},
// customize tsconfig.shared.json
sharedTsConfig: {
// ...
},
// customize tsconfig.node.json
nodeTsConfig: {
// ...
},
},
nitro: {
typescript: {
// customize tsconfig.server.json
tsConfig: {
// ...
},
},
},
})