Skip to content

vixt / core / NitroOptions

NitroOptions ​

Extends ​

  • Omit<NitroPluginConfig, "serverDir">

Properties ​

_cli? ​

optional _cli?: object

command? ​

optional command?: string

Inherited from ​

Omit._cli


_nitro? ​

optional _nitro?: Nitro

Internal

Use preinitialized Nitro instance for the plugin.

Inherited from ​

Omit._nitro


$development? ​

optional $development?: NitroConfig

Inherited from ​

Omit.$development


$env? ​

optional $env?: Record<string, NitroConfig>

Inherited from ​

Omit.$env


$meta? ​

optional $meta?: ConfigLayerMeta

Inherited from ​

Omit.$meta


$production? ​

optional $production?: NitroConfig

Inherited from ​

Omit.$production


$test? ​

optional $test?: NitroConfig

Inherited from ​

Omit.$test


alias? ​

optional alias?: Record<string, string>

Path aliases for module resolution.

Example ​

ts
alias: {
  "~utils": "./src/utils",
  "#shared": "./shared",
}

See ​

https://nitro.build/config#alias

Inherited from ​

Omit.alias


apiBaseURL? ​

optional apiBaseURL?: string

Base URL prefix for API routes.

Default ​

ts
"/api"

See ​

https://nitro.build/config#apibaseurl

Inherited from ​

Omit.apiBaseURL


apiDir? ​

optional apiDir?: string

Directory name to scan for API route handlers.

Default ​

ts
"api"

See ​

https://nitro.build/config#apidir

Inherited from ​

Omit.apiDir


awsAmplify? ​

optional awsAmplify?: AWSAmplifyOptions

Inherited from ​

Omit.awsAmplify


awsLambda? ​

optional awsLambda?: AwsLambdaOptions

Inherited from ​

Omit.awsLambda


azure? ​

optional azure?: AzureOptions

Inherited from ​

Omit.azure


baseURL? ​

optional baseURL?: string

Server's main base URL prefix.

Can also be set via the NITRO_APP_BASE_URL environment variable.

Default ​

ts
"/"

See ​

https://nitro.build/config#baseurl

Inherited from ​

Omit.baseURL


buildAssetsDir? ​

optional buildAssetsDir?: string

Directory (relative to the served base) for generated build assets.

Applied as the bundler assetsDir for client and SSR environments, so generated assets are emitted and referenced under this path. Presets can use it to relocate content-addressed assets (e.g. Vercel immutable static files under _vercel/immutable).

Inherited from ​

Omit.buildAssetsDir


buildDir? ​

optional buildDir?: string

Nitro's temporary working directory for build-related files.

Default ​

ts
"node_modules/.nitro"

See ​

https://nitro.build/config#builddir

Inherited from ​

Omit.buildDir


builder? ​

optional builder?: "rollup" | "rolldown" | "vite"

Bundler to use for production builds.

Auto-detected when not set: "vite" if a vite.config with the nitro() plugin is found, otherwise "rolldown" (bundled with Nitro). Use the NITRO_BUILDER environment variable as an alternative.

See ​

https://nitro.build/config#builder

Inherited from ​

Omit.builder


cloudflare? ​

optional cloudflare?: CloudflareOptions

Inherited from ​

Omit.cloudflare


commands? ​

optional commands?: object

Preview and deploy command hints (usually filled by deployment presets).

deploy? ​

optional deploy?: string

Command to deploy the production build.

preview? ​

optional preview?: string

Command to preview the production build locally.

See ​

https://nitro.build/config#commands

Inherited from ​

Omit.commands


commonJS? ​

optional commonJS?: any

Additional configuration for the Rollup CommonJS plugin.

See ​

https://nitro.build/config#commonjs

Inherited from ​

Omit.commonJS


compatibilityDate? ​

optional compatibilityDate?: CompatibilityDateSpec

Inherited from ​

Omit.compatibilityDate


compressPublicAssets? ​

optional compressPublicAssets?: boolean | CompressOptions

Pre-compress public assets and prerendered routes.

Generates gzip and brotli (and zstd when available) variants of compressible assets larger than 1024 bytes. Pass an object to selectively enable/disable each encoding.

See ​

https://nitro.build/config#compresspublicassets

Inherited from ​

Omit.compressPublicAssets


database? ​

optional database?: DatabaseConnectionConfigs

Database connection configurations.

Requires experimental.database: true.

See ​

Inherited from ​

Omit.database


debug? ​

optional debug?: boolean

Enables debugging nitro (build time) hooks in the console.

See ​

https://nitro.build/config#debug

Inherited from ​

Omit.debug


defaultPreset? ​

optional defaultPreset?: NitroPreset | PresetNameInput

Customize the preset used as the fallback when no preset is set and none of the known hosting providers are auto-detected.

By default, Nitro falls back to the runtime-based preset (node, and deno or bun when running on those runtimes). An explicit preset, the NITRO_PRESET environment variable, and auto-detected providers (Vercel, Netlify, Cloudflare Pages, …) all take precedence over this.

Accepts a preset name or an inline preset definition.

See ​

https://nitro.build/config#defaultpreset

Inherited from ​

Omit.defaultPreset


dev? ​

optional dev?: boolean

Whether the current build targets development mode.

Defaults to true during development and false for production.

See ​

https://nitro.build/config#dev

Inherited from ​

Omit.dev


devDatabase? ​

optional devDatabase?: DatabaseConnectionConfigs

Database connection overrides for development mode.

See ​

Inherited from ​

Omit.devDatabase


devErrorHandler? ​

optional devErrorHandler?: NitroErrorHandler

Custom error handler function for development mode.

See ​

https://nitro.build/config#deverrorhandler

Inherited from ​

Omit.devErrorHandler


devHandlers? ​

optional devHandlers?: NitroDevEventHandler[]

Development-only event handlers with inline handler functions.

Not included in production builds.

See ​

https://nitro.build/config#devhandlers

Inherited from ​

Omit.devHandlers


devProxy? ​

optional devProxy?: Record<string, string | ProxyServerOptions>

Proxy configuration for the development server.

A map of path prefixes to proxy target URLs or options.

Example ​

ts
devProxy: {
  "/proxy/test": "http://localhost:3001",
  "/proxy/example": { target: "https://example.com", changeOrigin: true },
}

See ​

Inherited from ​

Omit.devProxy


devServer? ​

optional devServer?: object

Development server options.

hostname? ​

optional hostname?: string

Hostname for the dev server.

port? ​

optional port?: number

Port number for the dev server.

runner? ​

optional runner?: RunnerName

Runtime runner to use for the dev server.

watch? ​

optional watch?: string[]

Additional paths to watch for dev server reloads.

See ​

https://nitro.build/config#devserver

Inherited from ​

Omit.devServer


devStorage? ​

optional devStorage?: StorageMounts

Storage mount overrides for development mode.

Useful for swapping production drivers (e.g. Redis) with local alternatives (e.g. filesystem) during development.

See ​

Inherited from ​

Omit.devStorage


enabled? ​

optional enabled?: boolean


entry? ​

optional entry?: string

Bundler entry point path.

See ​

https://nitro.build/config#entry

Inherited from ​

Omit.entry


errorHandler? ​

optional errorHandler?: string | string[]

Path(s) to custom runtime error handler(s).

Custom handlers run before the built-in error handler, which is always added as a fallback.

See ​

https://nitro.build/config#errorhandler

Inherited from ​

Omit.errorHandler


experimental? ​

optional experimental?: object & object

Experimental feature flags.

These features are not yet stable and may change in future releases.

Type Declaration ​

asyncContext? ​

optional asyncContext?: boolean

Enable native async context support for useRequest()

database? ​

optional database?: boolean

Enable experimental Database support

See ​

https://nitro.build/docs/database

envExpansion? ​

optional envExpansion?: boolean

Allow env expansion in runtime config

See ​

https://github.com/nitrojs/nitro/pull/2043

openAPI? ​

optional openAPI?: boolean

Enable experimental OpenAPI support

See ​

https://nitro.build/docs/openapi

sourcemapMinify? ​

optional sourcemapMinify?: false

Set to false to disable sourcemap minification in production builds.

Sourcemap minification is enabled by default when sourcemap is on.

tasks? ​

optional tasks?: boolean

Enable experimental Tasks support

See ​

https://nitro.build/docs/tasks

tracingLogger? ​

optional tracingLogger?: boolean

Log Nitro tracing-channel spans to the console.

Enables a built-in, dependency-free telemetry sink that console.logs each completed span (h3, srvx, unstorage, …). Requires tracingChannel to be enabled.

typescriptBundlerResolution? ​

optional typescriptBundlerResolution?: boolean

See https://github.com/microsoft/TypeScript/pull/51669

websocket? ​

optional websocket?: boolean

Enable WebSocket upgrade support

Deprecated ​

Use features.websocket instead.

vite? ​

optional vite?: object

vite.assetsImport? ​

optional assetsImport?: boolean

Experimental

Enable ?assets import proposed by https://github.com/vitejs/vite/discussions/20913

Default ​
ts
true
vite.serverReload? ​

optional serverReload?: boolean

Invalidate server-only modules and optionally reload the browser when a server-only module is updated.

Default ​
ts
true
vite.services? ​

optional services?: Record<string, ServiceConfig>

Additional Vite environment services to register.

See ​

https://nitro.build/config#experimental

Inherited from ​

Omit.experimental


exportConditions? ​

optional exportConditions?: string[]

Custom export conditions for module resolution.

See ​

https://nitro.build/config#exportconditions

Inherited from ​

Omit.exportConditions


extends? ​

optional extends?: string | string[] | NitroPreset

Inherited from ​

Omit.extends


features? ​

optional features?: object

Built-in feature flags.

runtimeHooks? ​

optional runtimeHooks?: boolean

Enable runtime hooks for request and response.

By default this feature will be enabled if there is at least one nitro plugin.

websocket? ​

optional websocket?: boolean

Enable WebSocket support.

See ​

https://nitro.build/config#features

Inherited from ​

Omit.features


firebase? ​

optional firebase?: FirebaseOptions

Inherited from ​

Omit.firebase


framework? ​

optional framework?: NitroFrameworkInfo

Metadata about the higher-level framework using Nitro (e.g. Nuxt).

Used by presets and included in build info output.

See ​

https://nitro.build/config#framework

Inherited from ​

Omit.framework


future? ​

optional future?: object

Future features pending a major version to avoid breaking changes.

nativeSWR? ​

optional nativeSWR?: boolean

Opt in to Nitro's native isr route rule handling on Vercel and suppress backwards-compatibility warnings for legacy swr/static route options.

See ​

https://nitro.build/config#future

Inherited from ​

Omit.future


handlers? ​

optional handlers?: NitroEventHandler[]

Server handler registrations.

Handlers in routes/, api/, and middleware/ directories are auto-registered when serverDir is set.

See ​

Inherited from ​

Omit.handlers


hooks? ​

optional hooks?: NestedHooks<NitroHooks>

Nitro lifecycle hooks.

See ​

Inherited from ​

Omit.hooks


ignore? ​

optional ignore?: string[]

Glob patterns to ignore when scanning directories.

See ​

https://nitro.build/config#ignore

Inherited from ​

Omit.ignore


iis? ​

optional iis?: object

IIS-specific deployment options.

mergeConfig? ​

optional mergeConfig?: boolean

Merge with existing IIS web.config instead of replacing.

overrideConfig? ​

optional overrideConfig?: boolean

Override existing IIS web.config entirely.

Inherited from ​

Omit.iis


inlineDynamicImports? ​

optional inlineDynamicImports?: boolean

Bundle all code into a single file instead of separate chunks.

When false, each route handler becomes a separate chunk loaded on-demand. Some presets enable this by default.

See ​

https://nitro.build/config#inlinedynamicimports

Inherited from ​

Omit.inlineDynamicImports


logging? ​

optional logging?: object

Build logging behavior.

buildSuccess? ​

optional buildSuccess?: boolean

Show the build success message.

compressedSizes? ​

optional compressedSizes?: boolean

Report compressed bundle sizes after build.

See ​

https://nitro.build/config#logging

Inherited from ​

Omit.logging


logLevel? ​

optional logLevel?: LogLevel

Log verbosity level.

Defaults to 3, or 1 when a testing environment is detected.

See ​

Inherited from ​

Omit.logLevel


manifest? ​

optional manifest?: object

Build manifest options.

deploymentId? ​

optional deploymentId?: string

Custom deployment identifier included in the build manifest.

Inherited from ​

Omit.manifest


minify? ​

optional minify?: boolean

Minify the production bundle.

See ​

https://nitro.build/config#minify

Inherited from ​

Omit.minify


modules? ​

optional modules?: NitroModuleInput[]

Nitro modules to extend behavior during initialization.

Accepts module path strings, NitroModule objects, or bare setup functions.

See ​

https://nitro.build/config#modules

Inherited from ​

Omit.modules


netlify? ​

optional netlify?: NetlifyOptions

Inherited from ​

Omit.netlify


node? ​

optional node?: boolean

Target a Node.js-compatible runtime.

When true (default), the bundler targets the node platform, prefers Node.js built-in modules, and enables dependency externalization.

When false, Nitro prepends the nodeless unenv preset to polyfill Node.js globals and built-ins for non-Node runtimes (workers, edge, Deno).

See ​

https://nitro.build/config#node

Inherited from ​

Omit.node


noExternals? ​

optional noExternals?: boolean | (string | RegExp)[]

Prevent packages from being externalized.

Set to true to bundle all dependencies, or pass an array of package names or patterns.

See ​

https://nitro.build/config#noexternals

Inherited from ​

Omit.noExternals


noPublicDir? ​

optional noPublicDir?: boolean

Disable the public output directory entirely.

Skips preparing the .output/public directory, copying public assets, and prerendering routes.

See ​

https://nitro.build/config#nopublicdir

Inherited from ​

Omit.noPublicDir


openAPI? ​

optional openAPI?: NitroOpenAPIConfig

OpenAPI specification generation and UI configuration.

See ​

Inherited from ​

Omit.openAPI


output? ​

optional output?: Partial<{ dir: string; publicDir: string; serverDir: string; }>

Inherited from ​

Omit.output


oxc? ​

optional oxc?: OXCOptions

OXC options for Rolldown builds (minification and transforms).

See ​

https://nitro.build/config#oxc

Inherited from ​

Omit.oxc


plugins? ​

optional plugins?: string[]

Paths to Nitro runtime plugins.

Plugins in the plugins/ directory are auto-registered.

See ​

Inherited from ​

Omit.plugins


prerender? ​

optional prerender?: object

Prerendering options.

Routes specified here are fetched during the build and copied to .output/public as static assets.

autoSubfolderIndex? ​

optional autoSubfolderIndex?: boolean

Prerender HTML routes within subfolders (/test produces /test/index.html).

concurrency? ​

optional concurrency?: number

Maximum number of concurrent prerender requests.

optional crawlLinks?: boolean

Crawl <a> tags in prerendered HTML to discover additional routes.

failOnError? ​

optional failOnError?: boolean

Fail the build when a route cannot be prerendered.

ignore? ​

optional ignore?: (string | RegExp | ((path) => boolean | null | undefined))[]

Patterns (string, RegExp, or function) of routes to skip.

ignoreUnprefixedPublicAssets? ​

optional ignoreUnprefixedPublicAssets?: boolean

Skip prerendering assets without a base URL prefix.

interval? ​

optional interval?: number

Delay in milliseconds between prerender requests.

retry? ​

optional retry?: number

Amount of retries. Pass Infinity to retry indefinitely.

Default ​
ts
3

retryDelay? ​

optional retryDelay?: number

Delay between each retry in ms.

Default ​
ts
500

routes? ​

optional routes?: string[]

Explicit list of routes to prerender.

See ​

https://nitro.build/config#prerender

Inherited from ​

Omit.prerender


preset? ​

optional preset?: PresetNameInput

Inherited from ​

Omit.preset


publicAssets? ​

optional publicAssets?: PublicAssetDir[]

Public asset directories served in development and bundled in production.

A public/ directory is added by default when detected.

See ​

Inherited from ​

Omit.publicAssets


renderer? ​

optional renderer?: false | { handler?: string; static?: boolean; template?: string; }

Inherited from ​

Omit.renderer


replace? ​

optional replace?: Record<string, string | ((id) => string)>

Build-time string replacements.

See ​

https://nitro.build/config#replace

Inherited from ​

Omit.replace


rolldownConfig? ​

optional rolldownConfig?: RolldownConfig

Additional Rolldown configuration.

See ​

https://nitro.build/config#rolldownconfig

Inherited from ​

Omit.rolldownConfig


rollupConfig? ​

optional rollupConfig?: Partial<RollupConfig>

Inherited from ​

Omit.rollupConfig


rootDir? ​

optional rootDir?: string

Project main root directory.

See ​

https://nitro.build/config#rootdir

Inherited from ​

Omit.rootDir


routeRules? ​

optional routeRules?: object

Index Signature ​

[path: string]: RouteRuleConfig

Inherited from ​

Omit.routeRules


routes? ​

optional routes?: Record<string, string | Omit<NitroEventHandler, "route" | "middleware">>

Inline route definitions.

A map from route pattern to handler path or handler options.

See ​

https://nitro.build/config#routes

Inherited from ​

Omit.routes


routesDir? ​

optional routesDir?: string

Directory name to scan for route handlers.

Default ​

ts
"routes"

See ​

https://nitro.build/config#routesdir

Inherited from ​

Omit.routesDir


runtimeConfig? ​

optional runtimeConfig?: NitroRuntimeConfig

Server runtime configuration accessible via useRuntimeConfig().

Values can be overridden at runtime using environment variables with the NITRO_ prefix. An alternative prefix can be configured via runtimeConfig.nitro.envPrefix or NITRO_ENV_PREFIX.

Note: The nitro namespace is reserved for internal use.

Example ​

ts
runtimeConfig: {
  apiSecret: "default-secret", // override with NITRO_API_SECRET
}

See ​

https://nitro.build/config#runtimeconfig

Inherited from ​

Omit.runtimeConfig


scanDirs? ​

optional scanDirs?: string[]

Additional directories to scan and auto-register files such as API route handlers.

See ​

https://nitro.build/config#scandirs

Inherited from ​

Omit.scanDirs


scheduledTasks? ​

optional scheduledTasks?: object

Map of cron expressions to task name(s).

Index Signature ​

[cron: string]: string | string[]

Example ​

ts
scheduledTasks: {
  "0 * * * *": "cleanup:temp",
  "*​/5 * * * *": ["health:check", "metrics:collect"],
}

See ​

Inherited from ​

Omit.scheduledTasks


serverAssets? ​

optional serverAssets?: ServerAssetDir[]

Server-side asset directories bundled at build time.

See ​

Inherited from ​

Omit.serverAssets


serverDir? ​

optional serverDir?: string & object | "./server" | "./"


serverEntry? ​

optional serverEntry?: string | false | { format?: EventHandlerFormat; handler: string; }

Inherited from ​

Omit.serverEntry


serveStatic? ​

optional serveStatic?: boolean | "node" | "inline"

Include a static asset handler in the server bundle to serve public assets.

  • true or "node" — read assets from the filesystem using Node.js fs.
  • "inline" — base64-encode assets directly into the server bundle.
  • false — do not serve static assets from the server (rely on a CDN or reverse proxy).

Most self-hosted presets (e.g. node-server, bun) enable this by default.

See ​

https://nitro.build/config#servestatic

Inherited from ​

Omit.serveStatic


sourcemap? ​

optional sourcemap?: boolean

Enable source map generation.

See ​

https://nitro.build/config#sourcemap

Inherited from ​

Omit.sourcemap


srcDir? ​

optional srcDir?: string

Deprecated ​

Migrate to serverDir.

Inherited from ​

Omit.srcDir


ssrRoutes? ​

optional ssrRoutes?: string[]

Routes that should be server-side rendered.

Inherited from ​

Omit.ssrRoutes


static? ​

optional static?: boolean

Disable the server build and only output prerendered static assets.

When true, the server bundle is skipped entirely and only the public directory is produced. Typically used by the static preset and its derivatives (e.g., github-pages, vercel-static).

Note: This does not enable prerendering on its own — configure prerender options separately.

See ​

https://nitro.build/config#static

Inherited from ​

Omit.static


storage? ​

optional storage?: StorageMounts

Storage mount configuration.

Keys are mount-point paths; values specify the unstorage driver and its options.

See ​

Inherited from ​

Omit.storage


tasks? ​

optional tasks?: object

Task definitions.

Each key is a task name with a handler path and optional description.

Index Signature ​

[name: string]: object

Example ​

ts
tasks: {
  "db:migrate": {
    handler: "./tasks/db-migrate",
    description: "Run database migrations",
  },
}

See ​

Inherited from ​

Omit.tasks


traceDeps? ​

optional traceDeps?: (string | RegExp)[]

Additional dependencies to trace and include in the build output.

Supports !pkg to exclude and pkg* for full package trace.

See ​

https://nitro.build/config#tracedeps

Inherited from ​

Omit.traceDeps


traceOpts? ​

optional traceOpts?: Pick<ExternalsTraceOptions, "hooks" | "transform" | "nft" | "traceAlias" | "chmod">

Advanced options for dependency tracing via nf3.

See ​

Inherited from ​

Omit.traceOpts


tracingChannel? ​

optional tracingChannel?: boolean | TracingOptions

Inherited from ​

Omit.tracingChannel


typescript? ​

optional typescript?: object

TypeScript configuration options.

tsConfig? ​

optional tsConfig?: Partial<TSConfig>

TypeScript config used by the bundler (JSX options and path aliases).

Defaults to the resolved tsconfig.json of the project root.

See ​

https://nitro.build/config#typescript

Inherited from ​

Omit.typescript


unenv? ​

optional unenv?: Preset | Preset[]

Inherited from ​

Omit.unenv


vercel? ​

optional vercel?: VercelOptions

Inherited from ​

Omit.vercel


virtual? ​

optional virtual?: Record<string, string | (() => string | Promise<string>)>

Virtual module definitions.

A map from dynamic virtual import names to their contents or an async function that returns them.

See ​

https://nitro.build/config#virtual

Inherited from ​

Omit.virtual


wasm? ​

optional wasm?: false | UnwasmPluginOptions

Native wasm compatibility/bundling support configuration.

Set to false to disable.

See ​

Inherited from ​

Omit.wasm


watchOptions? ​

optional watchOptions?: Partial<BasicOpts & object>

File watcher options for development mode.

See ​

Inherited from ​

Omit.watchOptions


workspaceDir? ​

optional workspaceDir?: string

Project workspace root directory.

Auto-detected from the workspace (e.g. pnpm workspace) when not set.

See ​

https://nitro.build/config#workspacedir

Inherited from ​

Omit.workspaceDir


zephyr? ​

optional zephyr?: ZephyrOptions

Inherited from ​

Omit.zephyr