nuxt.config.ts
Discover all the options you can use in yournuxt.config.ts file.
Overview
Thenuxt.config.ts file is located at the root of your Nuxt project and can override or extend the application’s behavior.
A minimal configuration file exports the defineNuxtConfig function containing an object with your configuration. The defineNuxtConfig helper is globally available without import.
Configuration Options
alias
You can improve your DX by defining additional aliases to access custom directories within your JavaScript and CSS. Type:object
Default:
app
Nuxt App configuration.app.baseURL
The base path of your Nuxt application.
Type: stringDefault:
"/"
NUXT_APP_BASE_URL environment variable.
app.head
Set default configuration for <head> on every page.
Type: object
buildDir
Define the directory where your built Nuxt files will be placed. Type:stringDefault:
"/<rootDir>/.nuxt"
components
Configure Nuxt component auto-registration. Type:object
Default:
css
You can define the CSS files/modules/libraries you want to set globally (included in every page). Type:array
devServer
Configuration for the development server.devServer.host
Dev server listening host.
devServer.port
Dev server listening port.
Type: numberDefault:
3000
devServer.https
Whether to enable HTTPS.
Type: booleanDefault:
false
dir
Customize default directory structure used by Nuxt.dir.app
Type: stringDefault:
"app"
dir.pages
The directory which will be processed to auto-generate your application page routes.
Type: stringDefault:
"app/pages"
dir.plugins
The plugins directory, each file of which will be auto-registered as a Nuxt plugin.
Type: stringDefault:
"app/plugins"
extends
Extend project from multiple local or remote sources. Value should be either a string or array of strings pointing to source directories or config path relative to current config. You can usegithub:, gh:, gitlab:, or bitbucket:.
modules
Modules are Nuxt extensions which can extend its core functionality and add endless integrations. Type:array
nitro
Configuration for Nitro. See Nitro configuration docs for more information.runtimeConfig
Runtime config allows passing dynamic config and environment variables to the Nuxt app context. Type:object
NUXT_API_KEY=my-api-key would overwrite the apiKey value.
ssr
Whether to enable rendering of HTML - either dynamically (in server mode) or at generate time. If set tofalse, generated pages will have no content.
Type: booleanDefault:
true
typescript
Configuration for Nuxt’s TypeScript integration.typescript.typeCheck
Enable build-time type checking.
Type: booleanDefault:
false
If set to true, this will type check in development. You can restrict this to build-time type checking by setting it to 'build'. Requires typescript and vue-tsc as dev dependencies.
typescript.strict
TypeScript comes with certain checks to give you more safety and analysis of your program.
Type: booleanDefault:
true
vite
Configuration that will be passed directly to Vite. See Vite configuration docs for more information.vue
Vue.js config.vue.compilerOptions
Options for the Vue compiler that will be passed at build time.
See Vue documentation for more information.
vue.runtimeCompiler
Include Vue compiler in runtime bundle.
Type: booleanDefault:
false
Environment Variables
Many configuration options can be overridden using environment variables:NUXT_APP_BASE_URL- Overrideapp.baseURLNUXT_APP_CDN_URL- Overrideapp.cdnURL- Runtime config values using
NUXT_prefix