Nuxt types and default configuration providing comprehensive TypeScript types, schema definitions, and configuration system for the Nuxt framework.
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
The configuration system in @nuxt/schema provides complete TypeScript coverage for all Nuxt configuration options, enabling type-safe configuration management and IntelliSense support.
The main user-facing configuration interface used in nuxt.config.ts files.
interface NuxtConfig extends DeepPartial<Omit<ConfigSchema, 'vue' | 'vite' | 'runtimeConfig' | 'webpack' | 'nitro'>> {
vue?: Omit<DeepPartial<ConfigSchema['vue']>, 'config'> & {
config?: Partial<Filter<VueAppConfig, string | boolean>>
}
vite?: ConfigSchema['vite']
nitro?: NitroConfig
runtimeConfig?: Overrideable<RuntimeConfig>
webpack?: DeepPartial<ConfigSchema['webpack']> & {
$client?: DeepPartial<ConfigSchema['webpack']>
$server?: DeepPartial<ConfigSchema['webpack']>
}
$schema?: SchemaDefinition
}The normalized internal configuration interface used by Nuxt at runtime.
interface NuxtOptions extends Omit<ConfigSchema, 'vue' | 'sourcemap' | 'debug' | 'builder' | 'postcss' | 'webpack'> {
vue: Omit<ConfigSchema['vue'], 'config'> & {
config?: Partial<Filter<VueAppConfig, string | boolean>>
}
sourcemap: Required<Exclude<ConfigSchema['sourcemap'], boolean>>
debug: Required<Exclude<ConfigSchema['debug'], true>>
builder: '@nuxt/vite-builder' | '@nuxt/webpack-builder' | '@nuxt/rspack-builder' | NuxtBuilder
postcss: Omit<ConfigSchema['postcss'], 'order'> & {
order: Exclude<ConfigSchema['postcss']['order'], string>
}
webpack: ConfigSchema['webpack'] & {
$client: ConfigSchema['webpack']
$server: ConfigSchema['webpack']
}
_layers: readonly NuxtConfigLayer[]
$schema: SchemaDefinition
}Configuration layer support for extending configurations from multiple sources.
type NuxtConfigLayer = ResolvedConfig<NuxtConfig & {
srcDir: ConfigSchema['srcDir']
rootDir: ConfigSchema['rootDir']
}> & {
cwd: string
configFile: string
}interface AppConfig {
baseURL: string
buildAssetsDir: string
cdnURL: string
head: NuxtAppConfig['head']
layoutTransition: NuxtAppConfig['layoutTransition']
pageTransition: NuxtAppConfig['pageTransition']
viewTransition: NuxtAppConfig['viewTransition']
keepalive: NuxtAppConfig['keepalive']
rootId: string | false
rootTag: string
rootAttrs: SerializableHtmlAttributes
teleportTag: string
teleportId: string | false
teleportAttrs: SerializableHtmlAttributes
spaLoaderTag: string
spaLoaderAttrs: SerializableHtmlAttributes
}interface VueConfig {
transformAssetUrls: AssetURLTagConfig
compilerOptions: CompilerOptions
runtimeCompiler: boolean
propsDestructure: boolean
config: Serializable<VueAppConfig>
}interface BuildConfig {
transpile: Array<string | RegExp | ((ctx: { isClient?: boolean, isServer?: boolean, isDev: boolean }) => string | RegExp | false)>
templates: NuxtTemplate<any>[]
analyze: boolean | { enabled?: boolean } & ((0 extends 1 & BundleAnalyzerPlugin.Options ? Record<string, unknown> : BundleAnalyzerPlugin.Options) | PluginVisualizerOptions)
}interface DevServerConfig {
https: boolean | { key: string, cert: string } | { pfx: string, passphrase: string }
port: number
host: string | undefined
url: string
loadingTemplate: (data: { loading?: string }) => string
cors: H3CorsOptions
}interface TypeScriptConfig {
strict: boolean
builder: 'vite' | 'webpack' | 'rspack' | 'shared' | false | undefined | null
hoist: Array<string>
includeWorkspace: boolean
typeCheck: boolean | 'build'
tsConfig: TSConfig & { vueCompilerOptions?: RawVueCompilerOptions }
nodeTsConfig: TSConfig
sharedTsConfig: TSConfig
shim: boolean
}Provides runtime override support for configuration values.
type RuntimeValue<T, B extends string> = T & { [message]?: B }
type UpperSnakeCase<S extends string> = Uppercase<SnakeCase<S>>Recursive partial type for configuration options.
type DeepPartial<T> = T extends Function
? T
: T extends Record<string, any>
? { [P in keyof T]?: DeepPartial<T[P]> }
: Timport type { NuxtConfig } from '@nuxt/schema';
const config: NuxtConfig = {
// Directory structure
srcDir: 'src/',
buildDir: '.output',
// Application settings
app: {
baseURL: '/app/',
head: {
title: 'My Nuxt App',
meta: [
{ name: 'description', content: 'My amazing Nuxt application' }
]
}
},
// Module system
modules: [
'@nuxtjs/tailwindcss',
['@pinia/nuxt', { autoImports: ['defineStore'] }]
],
// TypeScript configuration
typescript: {
strict: true,
typeCheck: true
}
};import type { NuxtConfig } from '@nuxt/schema';
const config: NuxtConfig = {
extends: [
'@nuxt/ui-pro',
'github:my-org/nuxt-base-layer'
],
// Runtime configuration with environment variable support
runtimeConfig: {
// Private keys (server-only)
apiSecret: process.env.API_SECRET,
// Public keys (exposed to client)
public: {
apiBase: process.env.NUXT_PUBLIC_API_BASE || '/api'
}
},
// Builder-specific configuration
vite: {
optimizeDeps: {
include: ['lodash-es']
}
},
webpack: {
extractCSS: true,
optimization: {
splitChunks: {
chunks: 'all'
}
}
}
};const config: NuxtConfig = {
experimental: {
// Enable experimental features
componentIslands: true,
typedPages: true,
viewTransition: true,
// Default options for composables
defaults: {
nuxtLink: {
trailingSlash: 'append'
},
useAsyncData: {
deep: false
}
}
},
future: {
compatibilityVersion: 4,
typescriptBundlerResolution: true
}
};The configuration system ensures that all options are properly typed and validated, providing excellent developer experience with full IntelliSense support and compile-time error checking.
Install with Tessl CLI
npx tessl i tessl/npm-nuxt--schema