@nuxt/schema
Advanced tools
Comparing version 3.0.0 to 3.1.0
2151
dist/index.d.ts
import { TransitionProps, KeepAliveProps } from 'vue'; | ||
import { RouterOptions as RouterOptions$1, RouterHistory } from 'vue-router'; | ||
import { UnimportOptions, InlinePreset, Import } from 'unimport'; | ||
import { UnimportOptions, InlinePreset, Import, Unimport } from 'unimport'; | ||
import { CompilerOptions } from '@vue/compiler-core'; | ||
@@ -15,2 +15,5 @@ import { Hookable } from 'hookable'; | ||
import { NitroConfig, Nitro, NitroEventHandler, NitroDevEventHandler } from 'nitropack'; | ||
import * as untyped from 'untyped'; | ||
import { SchemaDefinition, Schema } from 'untyped'; | ||
export { SchemaDefinition } from 'untyped'; | ||
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'; | ||
@@ -26,3 +29,2 @@ import { PluginVisualizerOptions } from 'rollup-plugin-visualizer'; | ||
import { MergeHead, Head } from '@unhead/schema'; | ||
import * as untyped from 'untyped'; | ||
@@ -309,2 +311,3 @@ /** | ||
global?: boolean; | ||
island?: boolean; | ||
mode?: 'client' | 'server' | 'all'; | ||
@@ -339,9 +342,9 @@ } | ||
/** | ||
* These properties (prefetch/preload) are used in production to configure how components with Lazy prefix are handled by Webpack via its magic comments. | ||
* Learn more on Webpack documentation: https://webpack.js.org/api/module-methods/#magic-comments | ||
* These properties (prefetch/preload) are used in production to configure how components with Lazy prefix are handled by webpack via its magic comments. | ||
* Learn more on webpack documentation: https://webpack.js.org/api/module-methods/#magic-comments | ||
*/ | ||
prefetch?: boolean; | ||
/** | ||
* These properties (prefetch/preload) are used in production to configure how components with Lazy prefix are handled by Webpack via its magic comments. | ||
* Learn more on Webpack documentation: https://webpack.js.org/api/module-methods/#magic-comments | ||
* These properties (prefetch/preload) are used in production to configure how components with Lazy prefix are handled by webpack via its magic comments. | ||
* Learn more on webpack documentation: https://webpack.js.org/api/module-methods/#magic-comments | ||
*/ | ||
@@ -359,2 +362,6 @@ preload?: boolean; | ||
global?: boolean; | ||
/** | ||
* If enabled, registers components as islands | ||
*/ | ||
island?: boolean; | ||
} | ||
@@ -418,3 +425,3 @@ interface ComponentsDir extends ScanDir { | ||
* | ||
* @see https://v3.nuxtjs.org/guide/directory-structure/composables/#how-files-are-scanned | ||
* @see https://nuxt.com/docs/guide/directory-structure/composables#how-files-are-scanned | ||
* @default ['./composables', './utils'] | ||
@@ -483,2 +490,3 @@ */ | ||
'imports:extend': (imports: Import[]) => HookResult; | ||
'imports:context': (context: Unimport) => HookResult; | ||
'imports:dirs': (dirs: string[]) => HookResult; | ||
@@ -500,2 +508,6 @@ 'components:dirs': (dirs: ComponentsOptions['dirs']) => HookResult; | ||
'listen': (listenerServer: Server | Server$1, listener: any) => HookResult; | ||
'schema:extend': (schemas: SchemaDefinition[]) => void; | ||
'schema:resolved': (schema: Schema) => void; | ||
'schema:beforeWrite': (schema: Schema) => void; | ||
'schema:written': () => void; | ||
'vite:extend': (viteBuildContext: { | ||
@@ -620,1249 +632,1395 @@ nuxt: Nuxt; | ||
interface ConfigSchema { | ||
/** | ||
* Configure Nuxt component auto-registration. | ||
* Any components in the directories configured here can be used throughout your pages, layouts (and other components) without needing to explicitly import them. | ||
/** | ||
* Configure Nuxt component auto-registration. | ||
* | ||
* Any components in the directories configured here can be used throughout your pages, layouts (and other components) without needing to explicitly import them. | ||
* | ||
* | ||
* @see https://nuxt.com/docs/guide/directory-structure/components | ||
*/ | ||
components: boolean | ComponentsOptions | ComponentsOptions['dirs'], | ||
/** | ||
* Configure how Nuxt auto-imports composables into your application. | ||
* | ||
* | ||
* @see [Nuxt 3 documentation](https://nuxt.com/docs/guide/directory-structure/composables) | ||
*/ | ||
imports: ImportsOptions, | ||
/** | ||
* Whether to use the vue-router integration in Nuxt 3. If you do not provide a value it will be enabled if you have a `pages/` directory in your source folder. | ||
* | ||
*/ | ||
pages: boolean, | ||
/** | ||
* Manually disable nuxt telemetry. | ||
* | ||
* | ||
* @see [Nuxt Telemetry](https://github.com/nuxt/telemetry) for more information. | ||
*/ | ||
telemetry: boolean, | ||
/** | ||
* Vue.js config | ||
* | ||
*/ | ||
vue: { | ||
/** | ||
* Options for the Vue compiler that will be passed at build time. | ||
* | ||
* @default {{ dirs: [`~/components`] }} | ||
* | ||
* @see https://v3.nuxtjs.org/guide/directory-structure/components | ||
* @see [documentation](https://vuejs.org/api/application.html#app-config-compileroptions) | ||
*/ | ||
components: boolean | ComponentsOptions | ComponentsOptions['dirs'], | ||
compilerOptions: CompilerOptions, | ||
}, | ||
/** | ||
* Nuxt App configuration. | ||
* | ||
*/ | ||
app: { | ||
/** | ||
* Configure how Nuxt auto-imports composables into your application. | ||
* The base path of your Nuxt application. | ||
* | ||
* @see [Nuxt 3 documentation](https://v3.nuxtjs.org/guide/directory-structure/composables) | ||
* This can be set at runtime by setting the NUXT_APP_BASE_URL environment variable. | ||
* | ||
* @default "/" | ||
* | ||
* @example | ||
* ```bash | ||
* NUXT_APP_BASE_URL=/prefix/ node .output/server/index.mjs | ||
* ``` | ||
*/ | ||
imports: ImportsOptions, | ||
baseURL: string, | ||
/** Whether to use the vue-router integration in Nuxt 3. If you do not provide a value it will be enabled if you have a `pages/` directory in your source folder. */ | ||
pages: boolean, | ||
/** | ||
* The folder name for the built site assets, relative to `baseURL` (or `cdnURL` if set). This is set at build time and should not be customized at runtime. | ||
* | ||
* @default "/_nuxt/" | ||
*/ | ||
buildAssetsDir: string, | ||
/** | ||
* Manually disable nuxt telemetry. | ||
* An absolute URL to serve the public folder from (production-only). | ||
* | ||
* @see [Nuxt Telemetry](https://github.com/nuxt/telemetry) for more information. | ||
* This can be set to a different value at runtime by setting the `NUXT_APP_CDN_URL` environment variable. | ||
* | ||
* @default "" | ||
* | ||
* @example | ||
* ```bash | ||
* NUXT_APP_CDN_URL=https://mycdn.org/ node .output/server/index.mjs | ||
* ``` | ||
*/ | ||
telemetry: boolean, | ||
cdnURL: string, | ||
/** Vue.js config */ | ||
vue: { | ||
/** | ||
* Options for the Vue compiler that will be passed at build time. | ||
* | ||
* @see [documentation](https://vuejs.org/api/application.html#app-config-compileroptions) | ||
*/ | ||
compilerOptions: CompilerOptions, | ||
}, | ||
/** | ||
* Set default configuration for `<head>` on every page. | ||
* | ||
* | ||
* @example | ||
* ```js | ||
* app: { | ||
* head: { | ||
* meta: [ | ||
* // <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
* { name: 'viewport', content: 'width=device-width, initial-scale=1' } | ||
* ], | ||
* script: [ | ||
* // <script src="https://myawesome-lib.js"></script> | ||
* { src: 'https://awesome-lib.js' } | ||
* ], | ||
* link: [ | ||
* // <link rel="stylesheet" href="https://myawesome-lib.css"> | ||
* { rel: 'stylesheet', href: 'https://awesome-lib.css' } | ||
* ], | ||
* // please note that this is an area that is likely to change | ||
* style: [ | ||
* // <style type="text/css">:root { color: red }</style> | ||
* { children: ':root { color: red }', type: 'text/css' } | ||
* ], | ||
* noscript: [ | ||
* // <noscript>JavaScript is required</noscript> | ||
* { children: 'JavaScript is required' } | ||
* ] | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
head: NuxtAppConfig['head'], | ||
/** Nuxt App configuration. */ | ||
app: { | ||
/** | ||
* The base path of your Nuxt application. | ||
* This can be set at runtime by setting the NUXT_APP_BASE_URL environment variable. | ||
* @default "/" | ||
* | ||
* @example | ||
* ```bash | ||
* NUXT_APP_BASE_URL=/prefix/ node .output/server/index.mjs | ||
* ``` | ||
*/ | ||
baseURL: string, | ||
/** | ||
* Default values for layout transitions. | ||
* | ||
* This can be overridden with `definePageMeta` on an individual page. Only JSON-serializable values are allowed. | ||
* | ||
* @default false | ||
* | ||
* @see https://vuejs.org/api/built-in-components.html#transition | ||
*/ | ||
layoutTransition: NuxtAppConfig['layoutTransition'], | ||
/** | ||
* The folder name for the built site assets, relative to `baseURL` (or `cdnURL` if set). This is set at build time and should not be customized at runtime. | ||
* @default "/_nuxt/" | ||
*/ | ||
buildAssetsDir: string, | ||
/** | ||
* Default values for page transitions. | ||
* | ||
* This can be overridden with `definePageMeta` on an individual page. Only JSON-serializable values are allowed. | ||
* | ||
* @default false | ||
* | ||
* @see https://vuejs.org/api/built-in-components.html#transition | ||
*/ | ||
pageTransition: NuxtAppConfig['pageTransition'], | ||
/** | ||
* An absolute URL to serve the public folder from (production-only). | ||
* This can be set to a different value at runtime by setting the `NUXT_APP_CDN_URL` environment variable. | ||
* @default "" | ||
* | ||
* @example | ||
* ```bash | ||
* NUXT_APP_CDN_URL=https://mycdn.org/ node .output/server/index.mjs | ||
* ``` | ||
*/ | ||
cdnURL: string, | ||
/** | ||
* Default values for KeepAlive configuration between pages. | ||
* | ||
* This can be overridden with `definePageMeta` on an individual page. Only JSON-serializable values are allowed. | ||
* | ||
* @default false | ||
* | ||
* @see https://vuejs.org/api/built-in-components.html#keepalive | ||
*/ | ||
keepalive: NuxtAppConfig['keepalive'], | ||
/** | ||
* Set default configuration for `<head>` on every page. | ||
* | ||
* @example | ||
* ```js | ||
* app: { | ||
* head: { | ||
* meta: [ | ||
* // <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
* { name: 'viewport', content: 'width=device-width, initial-scale=1' } | ||
* ], | ||
* script: [ | ||
* // <script src="https://myawesome-lib.js"></script> | ||
* { src: 'https://awesome-lib.js' } | ||
* ], | ||
* link: [ | ||
* // <link rel="stylesheet" href="https://myawesome-lib.css"> | ||
* { rel: 'stylesheet', href: 'https://awesome-lib.css' } | ||
* ], | ||
* // please note that this is an area that is likely to change | ||
* style: [ | ||
* // <style type="text/css">:root { color: red }</style> | ||
* { children: ':root { color: red }', type: 'text/css' } | ||
* ], | ||
* noscript: [ | ||
* // <noscript>Javascript is required</noscript> | ||
* { children: 'Javascript is required' } | ||
* ] | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
head: NuxtAppConfig['head'], | ||
/** | ||
* Customize Nuxt root element id. | ||
* | ||
* @default "__nuxt" | ||
*/ | ||
rootId: string, | ||
/** | ||
* Default values for layout transitions. | ||
* This can be overridden with `definePageMeta` on an individual page. Only JSON-serializable values are allowed. | ||
* @default false | ||
* | ||
* @see https://vuejs.org/api/built-in-components.html#transition | ||
*/ | ||
layoutTransition: NuxtAppConfig['layoutTransition'], | ||
/** | ||
* Customize Nuxt root element tag. | ||
* | ||
* @default "div" | ||
*/ | ||
rootTag: string, | ||
}, | ||
/** | ||
* Default values for page transitions. | ||
* This can be overridden with `definePageMeta` on an individual page. Only JSON-serializable values are allowed. | ||
* @default false | ||
* | ||
* @see https://vuejs.org/api/built-in-components.html#transition | ||
*/ | ||
pageTransition: NuxtAppConfig['pageTransition'], | ||
/** | ||
* An array of nuxt app plugins. | ||
* | ||
* Each plugin can be a string (which can be an absolute or relative path to a file). If it ends with `.client` or `.server` then it will be automatically loaded only in the appropriate context. | ||
* It can also be an object with `src` and `mode` keys. | ||
* | ||
* | ||
* @note Plugins are also auto-registered from the `~/plugins` directory | ||
* and these plugins do not need to be listed in `nuxt.config` unless you | ||
* need to customize their order. All plugins are deduplicated by their src path. | ||
* | ||
* @see https://nuxt.com/docs/guide/directory-structure/plugins | ||
* | ||
* @example | ||
* ```js | ||
* plugins: [ | ||
* '~/plugins/foo.client.js', // only in client side | ||
* '~/plugins/bar.server.js', // only in server side | ||
* '~/plugins/baz.js', // both client & server | ||
* { src: '~/plugins/both-sides.js' }, | ||
* { src: '~/plugins/client-only.js', mode: 'client' }, // only on client side | ||
* { src: '~/plugins/server-only.js', mode: 'server' } // only on server side | ||
* ] | ||
* ``` | ||
*/ | ||
plugins: (NuxtPlugin | string)[], | ||
/** | ||
* Default values for KeepAlive configuration between pages. | ||
* This can be overridden with `definePageMeta` on an individual page. Only JSON-serializable values are allowed. | ||
* @default false | ||
* | ||
* @see https://vuejs.org/api/built-in-components.html#keepalive | ||
*/ | ||
keepalive: NuxtAppConfig['keepalive'], | ||
/** | ||
* You can define the CSS files/modules/libraries you want to set globally (included in every page). | ||
* | ||
* Nuxt will automatically guess the file type by its extension and use the appropriate pre-processor. You will still need to install the required loader if you need to use them. | ||
* | ||
* | ||
* @example | ||
* ```js | ||
* css: [ | ||
* // Load a Node.js module directly (here it's a Sass file). | ||
* 'bulma', | ||
* // CSS file in the project | ||
* '@/assets/css/main.css', | ||
* // SCSS file in the project | ||
* '@/assets/css/main.scss' | ||
* ] | ||
* ``` | ||
*/ | ||
css: string[], | ||
/** | ||
* Customize Nuxt root element id. | ||
* @default "__nuxt" | ||
*/ | ||
rootId: string, | ||
/** | ||
* The builder to use for bundling the Vue part of your application. | ||
* | ||
* @default "@nuxt/vite-builder" | ||
*/ | ||
builder: 'vite' | 'webpack' | { bundle: (nuxt: Nuxt) => Promise<void> }, | ||
/** | ||
* Customize Nuxt root element tag. | ||
* @default "div" | ||
*/ | ||
rootTag: string, | ||
}, | ||
/** | ||
* Whether to generate sourcemaps. | ||
* | ||
*/ | ||
sourcemap: boolean | { server?: boolean, client?: boolean }, | ||
/** | ||
* Shared build configuration. | ||
* | ||
*/ | ||
build: { | ||
/** | ||
* An array of nuxt app plugins. | ||
* Each plugin can be a string (which can be an absolute or relative path to a file). If it ends with `.client` or `.server` then it will be automatically loaded only in the appropriate context. | ||
* It can also be an object with `src` and `mode` keys. | ||
* If you want to transpile specific dependencies with Babel, you can add them here. Each item in transpile can be a package name, a function, a string or regex object matching the dependency's file name. | ||
* | ||
* You can also use a function to conditionally transpile. The function will receive an object ({ isDev, isServer, isClient, isModern, isLegacy }). | ||
* | ||
* | ||
* @example | ||
* ```js | ||
* plugins: [ | ||
* '~/plugins/foo.client.js', // only in client side | ||
* '~/plugins/bar.server.js', // only in server side | ||
* '~/plugins/baz.js', // both client & server | ||
* { src: '~/plugins/both-sides.js' }, | ||
* { src: '~/plugins/client-only.js', mode: 'client' }, // only on client side | ||
* { src: '~/plugins/server-only.js', mode: 'server' } // only on server side | ||
* ] | ||
* transpile: [({ isLegacy }) => isLegacy && 'ky'] | ||
* ``` | ||
*/ | ||
plugins: (NuxtPlugin | string)[], | ||
transpile: Array<string | RegExp | ((ctx: { isClient?: boolean; isServer?: boolean; isDev: boolean }) => string | RegExp | false)>, | ||
/** | ||
* You can define the CSS files/modules/libraries you want to set globally (included in every page). | ||
* Nuxt will automatically guess the file type by its extension and use the appropriate pre-processor. You will still need to install the required loader if you need to use them. | ||
* You can provide your own templates which will be rendered based on Nuxt configuration. This feature is specially useful for using with modules. | ||
* | ||
* Templates are rendered using [`lodash.template`](https://lodash.com/docs/4.17.15#template). | ||
* | ||
* | ||
* @example | ||
* ```js | ||
* css: [ | ||
* // Load a Node.js module directly (here it's a Sass file). | ||
* 'bulma', | ||
* // CSS file in the project | ||
* '@/assets/css/main.css', | ||
* // SCSS file in the project | ||
* '@/assets/css/main.scss' | ||
* templates: [ | ||
* { | ||
* src: '~/modules/support/plugin.js', // `src` can be absolute or relative | ||
* dst: 'support.js', // `dst` is relative to project `.nuxt` dir | ||
* options: { | ||
* // Options are provided to template as `options` key | ||
* live_chat: false | ||
* } | ||
* } | ||
* ] | ||
* ``` | ||
*/ | ||
css: string[], | ||
templates: Array<any>, | ||
/** | ||
* The builder to use for bundling the Vue part of your application. | ||
* @default "@nuxt/vite-builder" | ||
* Nuxt uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them. | ||
* | ||
* Set to `true` to enable bundle analysis, or pass an object with options: [for webpack](https://github.com/webpack-contrib/webpack-bundle-analyzer#options-for-plugin) or [for vite](https://github.com/btd/rollup-plugin-visualizer#options). | ||
* | ||
* @default false | ||
* | ||
* @example | ||
* ```js | ||
* analyze: { | ||
* analyzerMode: 'static' | ||
* } | ||
* ``` | ||
*/ | ||
builder: 'vite' | 'webpack' | { bundle: (nuxt: Nuxt) => Promise<void> }, | ||
analyze: boolean | BundleAnalyzerPlugin.Options | PluginVisualizerOptions, | ||
}, | ||
/** Whether to generate sourcemaps. */ | ||
sourcemap: boolean | { server?: boolean, client?: boolean }, | ||
/** | ||
* 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 use `github:`, `gitlab:`, `bitbucket:` or `https://` to extend from a remote git repository. | ||
* | ||
*/ | ||
extends: string|string[], | ||
/** Shared build configuration. */ | ||
build: { | ||
/** | ||
* If you want to transpile specific dependencies with Babel, you can add them here. Each item in transpile can be a package name, a function, a string or regex object matching the dependency's file name. | ||
* You can also use a function to conditionally transpile. The function will receive an object ({ isDev, isServer, isClient, isModern, isLegacy }). | ||
* | ||
* @example | ||
* ```js | ||
* transpile: [({ isLegacy }) => isLegacy && 'ky'] | ||
* ``` | ||
*/ | ||
transpile: Array<string | RegExp | Function>, | ||
/** | ||
* Extend project from a local or remote source. | ||
* | ||
* Value should be a string pointing to source directory or config path relative to current config. | ||
* You can use `github:`, `gitlab:`, `bitbucket:` or `https://` to extend from a remote git repository. | ||
* | ||
* @default null | ||
*/ | ||
theme: string, | ||
/** | ||
* You can provide your own templates which will be rendered based on Nuxt configuration. This feature is specially useful for using with modules. | ||
* Templates are rendered using [`lodash.template`](https://lodash.com/docs/4.17.15#template). | ||
* | ||
* @example | ||
* ```js | ||
* templates: [ | ||
* { | ||
* src: '~/modules/support/plugin.js', // `src` can be absolute or relative | ||
* dst: 'support.js', // `dst` is relative to project `.nuxt` dir | ||
* options: { | ||
* // Options are provided to template as `options` key | ||
* live_chat: false | ||
* } | ||
* } | ||
* ] | ||
* ``` | ||
*/ | ||
templates: Array<any>, | ||
/** | ||
* Define the root directory of your application. | ||
* | ||
* This property can be overwritten (for example, running `nuxt ./my-app/` will set the `rootDir` to the absolute path of `./my-app/` from the current/working directory. | ||
* It is normally not needed to configure this option. | ||
* | ||
* @default "/<rootDir>" | ||
*/ | ||
rootDir: string, | ||
/** | ||
* Nuxt uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them. | ||
* Set to `true` to enable bundle analysis, or pass an object with options: [for webpack](https://github.com/webpack-contrib/webpack-bundle-analyzer#options-for-plugin) or [for vite](https://github.com/btd/rollup-plugin-visualizer#options). | ||
* @default false | ||
* | ||
* @example | ||
* ```js | ||
* analyze: { | ||
* analyzerMode: 'static' | ||
* } | ||
* ``` | ||
*/ | ||
analyze: boolean | BundleAnalyzerPlugin.Options | PluginVisualizerOptions, | ||
}, | ||
/** | ||
* Define the workspace directory of your application. | ||
* | ||
* Often this is used when in a monorepo setup. Nuxt will attempt to detect your workspace directory automatically, but you can override it here. | ||
* It is normally not needed to configure this option. | ||
* | ||
* @default "/<rootDir>" | ||
*/ | ||
workspaceDir: string, | ||
/** | ||
* Define the source directory of your Nuxt application. | ||
* | ||
* If a relative path is specified, it will be relative to the `rootDir`. | ||
* | ||
* @default "/<rootDir>" | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* srcDir: 'src/' | ||
* } | ||
* ``` | ||
* This would work with the following folder structure: | ||
* ```bash | ||
* -| app/ | ||
* ---| node_modules/ | ||
* ---| nuxt.config.js | ||
* ---| package.json | ||
* ---| src/ | ||
* ------| assets/ | ||
* ------| components/ | ||
* ------| layouts/ | ||
* ------| middleware/ | ||
* ------| pages/ | ||
* ------| plugins/ | ||
* ------| static/ | ||
* ------| store/ | ||
* ------| server/ | ||
* ``` | ||
*/ | ||
srcDir: string, | ||
/** | ||
* Define the server directory of your Nuxt application, where Nitro routes, middleware and plugins are kept. | ||
* | ||
* If a relative path is specified, it will be relative to your `rootDir`. | ||
* | ||
* @default "/<rootDir>/server" | ||
*/ | ||
serverDir: string, | ||
/** | ||
* Define the directory where your built Nuxt files will be placed. | ||
* | ||
* Many tools assume that `.nuxt` is a hidden directory (because it starts with a `.`). If that is a problem, you can use this option to prevent that. | ||
* | ||
* @default "/<rootDir>/.nuxt" | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* buildDir: 'nuxt-build' | ||
* } | ||
* ``` | ||
*/ | ||
buildDir: string, | ||
/** | ||
* Used to set the modules directories for path resolving (for example, webpack's `resolveLoading`, `nodeExternals` and `postcss`). | ||
* | ||
* The configuration path is relative to `options.rootDir` (default is current working directory). | ||
* Setting this field may be necessary if your project is organized as a yarn workspace-styled mono-repository. | ||
* | ||
* @default ["/<rootDir>/node_modules","/Users/daniel/code/nuxt.js/packages/schema/node_modules"] | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* modulesDir: ['../../node_modules'] | ||
* } | ||
* ``` | ||
*/ | ||
modulesDir: Array<string>, | ||
/** | ||
* Whether Nuxt is running in development mode. | ||
* | ||
* Normally, you should not need to set this. | ||
* | ||
* @default false | ||
*/ | ||
dev: boolean, | ||
/** | ||
* Whether your app is being unit tested. | ||
* | ||
* @default false | ||
*/ | ||
test: boolean, | ||
/** | ||
* Set to `true` to enable debug mode. | ||
* | ||
* At the moment, it prints out hook names and timings on the server, and logs hook arguments as well in the browser. | ||
* | ||
* @default false | ||
*/ | ||
debug: boolean, | ||
/** | ||
* Whether to enable rendering of HTML - either dynamically (in server mode) or at generate time. If set to `false` and combined with `static` target, generated pages will simply display a loading screen with no content. | ||
* | ||
* @default true | ||
*/ | ||
ssr: boolean, | ||
/** | ||
* Modules are Nuxt extensions which can extend its core functionality and add endless integrations. | ||
* | ||
* Each module is either a string (which can refer to a package, or be a path to a file), a tuple with the module as first string and the options as a second object, or an inline module function. | ||
* Nuxt tries to resolve each item in the modules array using node require path (in `node_modules`) and then will be resolved from project `srcDir` if `~` alias is used. | ||
* | ||
* | ||
* @note Modules are executed sequentially so the order is important. | ||
* | ||
* @example | ||
* ```js | ||
* modules: [ | ||
* // Using package name | ||
* '@nuxtjs/axios', | ||
* // Relative to your project srcDir | ||
* '~/modules/awesome.js', | ||
* // Providing options | ||
* ['@nuxtjs/google-analytics', { ua: 'X1234567' }], | ||
* // Inline definition | ||
* function () {} | ||
* ] | ||
* ``` | ||
*/ | ||
modules: (NuxtModule | string | [NuxtModule | string, Record<string, any>])[], | ||
/** | ||
* Customize default directory structure used by Nuxt. | ||
* | ||
* It is better to stick with defaults unless needed. | ||
* | ||
*/ | ||
dir: { | ||
/** | ||
* 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 use `github:`, `gitlab:`, `bitbucket:` or `https://` to extend from a remote git repository. | ||
* The assets directory (aliased as `~assets` in your build). | ||
* | ||
* @default "assets" | ||
*/ | ||
extends: string|string[], | ||
assets: string, | ||
/** | ||
* Extend project from a local or remote source. | ||
* Value should be a string pointing to source directory or config path relative to current config. | ||
* You can use `github:`, `gitlab:`, `bitbucket:` or `https://` to extend from a remote git repository. | ||
* @default null | ||
* The layouts directory, each file of which will be auto-registered as a Nuxt layout. | ||
* | ||
* @default "layouts" | ||
*/ | ||
theme: string, | ||
layouts: string, | ||
/** | ||
* Define the root directory of your application. | ||
* This property can be overwritten (for example, running `nuxt ./my-app/` will set the `rootDir` to the absolute path of `./my-app/` from the current/working directory. | ||
* It is normally not needed to configure this option. | ||
* @default "/<rootDir>" | ||
* The middleware directory, each file of which will be auto-registered as a Nuxt middleware. | ||
* | ||
* @default "middleware" | ||
*/ | ||
rootDir: string, | ||
middleware: string, | ||
/** | ||
* Define the workspace directory of your application. | ||
* Often this is used when in a monorepo setup. Nuxt will attempt to detect your workspace directory automatically, but you can override it here. | ||
* It is normally not needed to configure this option. | ||
* @default "/<rootDir>" | ||
* The directory which will be processed to auto-generate your application page routes. | ||
* | ||
* @default "pages" | ||
*/ | ||
workspaceDir: string, | ||
pages: string, | ||
/** | ||
* Define the source directory of your Nuxt application. | ||
* If a relative path is specified, it will be relative to the `rootDir`. | ||
* @default "/<rootDir>" | ||
* The plugins directory, each file of which will be auto-registered as a Nuxt plugin. | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* srcDir: 'src/' | ||
* } | ||
* ``` | ||
* This would work with the following folder structure: | ||
* ```bash | ||
* -| app/ | ||
* ---| node_modules/ | ||
* ---| nuxt.config.js | ||
* ---| package.json | ||
* ---| src/ | ||
* ------| assets/ | ||
* ------| components/ | ||
* ------| layouts/ | ||
* ------| middleware/ | ||
* ------| pages/ | ||
* ------| plugins/ | ||
* ------| static/ | ||
* ------| store/ | ||
* ------| server/ | ||
* ``` | ||
* @default "plugins" | ||
*/ | ||
srcDir: string, | ||
plugins: string, | ||
/** | ||
* Define the server directory of your Nuxt application, where Nitro routes, middleware and plugins are kept. | ||
* If a relative path is specified, it will be relative to your `rootDir`. | ||
* @default "/<rootDir>/server" | ||
* The directory containing your static files, which will be directly accessible via the Nuxt server and copied across into your `dist` folder when your app is generated. | ||
* | ||
* @default "public" | ||
*/ | ||
serverDir: string, | ||
public: string, | ||
/** | ||
* Define the directory where your built Nuxt files will be placed. | ||
* Many tools assume that `.nuxt` is a hidden directory (because it starts with a `.`). If that is a problem, you can use this option to prevent that. | ||
* @default "/<rootDir>/.nuxt" | ||
* @default "public" | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* buildDir: 'nuxt-build' | ||
* } | ||
* ``` | ||
* @deprecated use `dir.public` option instead | ||
*/ | ||
buildDir: string, | ||
static: string, | ||
}, | ||
/** | ||
* The extensions that should be resolved by the Nuxt resolver. | ||
* | ||
* @default [".js",".jsx",".mjs",".ts",".tsx",".vue"] | ||
*/ | ||
extensions: Array<string>, | ||
/** | ||
* You can improve your DX by defining additional aliases to access custom directories within your JavaScript and CSS. | ||
* | ||
* | ||
* @note Within a webpack context (image sources, CSS - but not JavaScript) you _must_ access | ||
* your alias by prefixing it with `~`. | ||
* | ||
* @note These aliases will be automatically added to the generated `.nuxt/tsconfig.json` so you can get full | ||
* type support and path auto-complete. In case you need to extend options provided by `./.nuxt/tsconfig.json` | ||
* further, make sure to add them here or within the `typescript.tsConfig` property in `nuxt.config`. | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* alias: { | ||
* 'images': fileURLToPath(new URL('./assets/images', import.meta.url)), | ||
* 'style': fileURLToPath(new URL('./assets/style', import.meta.url)), | ||
* 'data': fileURLToPath(new URL('./assets/other/data', import.meta.url)) | ||
* } | ||
* } | ||
* ``` | ||
* | ||
* ```html | ||
* <template> | ||
* <img src="~images/main-bg.jpg"> | ||
* </template> | ||
* | ||
* <script> | ||
* import data from 'data/test.json' | ||
* </script> | ||
* | ||
* <style> | ||
* // Uncomment the below | ||
* //@import '~style/variables.scss'; | ||
* //@import '~style/utils.scss'; | ||
* //@import '~style/base.scss'; | ||
* body { | ||
* background-image: url('~images/main-bg.jpg'); | ||
* } | ||
* </style> | ||
* ``` | ||
*/ | ||
alias: Record<string, string>, | ||
/** | ||
* Pass options directly to `node-ignore` (which is used by Nuxt to ignore files). | ||
* | ||
* | ||
* @see [node-ignore](https://github.com/kaelzhang/node-ignore) | ||
* | ||
* @example | ||
* ```js | ||
* ignoreOptions: { | ||
* ignorecase: false | ||
* } | ||
* ``` | ||
*/ | ||
ignoreOptions: any, | ||
/** | ||
* Any file in `pages/`, `layouts/`, `middleware/` or `store/` will be ignored during building if its filename starts with the prefix specified by `ignorePrefix`. | ||
* | ||
* @default "-" | ||
*/ | ||
ignorePrefix: string, | ||
/** | ||
* More customizable than `ignorePrefix`: all files matching glob patterns specified inside the `ignore` array will be ignored in building. | ||
* | ||
* @default ["**\/*.stories.{js,ts,jsx,tsx}","**\/*.{spec,test}.{js,ts,jsx,tsx}","**\/*.d.ts",".output","**\/-*.*"] | ||
*/ | ||
ignore: Array<string>, | ||
/** | ||
* The watchers property lets you overwrite watchers configuration in your `nuxt.config`. | ||
* | ||
*/ | ||
watchers: { | ||
/** | ||
* Used to set the modules directories for path resolving (for example, webpack's `resolveLoading`, `nodeExternals` and `postcss`). | ||
* The configuration path is relative to `options.rootDir` (default is current working directory). | ||
* Setting this field may be necessary if your project is organized as a yarn workspace-styled mono-repository. | ||
* @default ["/<rootDir>/node_modules","/Users/pooya/Code/framework/packages/schema/node_modules"] | ||
* An array of event types, which, when received, will cause the watcher to restart. | ||
* | ||
*/ | ||
rewatchOnRawEvents: any, | ||
/** | ||
* `watchOptions` to pass directly to webpack. | ||
* | ||
* | ||
* @see [webpack@4 watch options](https://v4.webpack.js.org/configuration/watch/#watchoptions). | ||
*/ | ||
webpack: { | ||
/** @default 1000 */ | ||
aggregateTimeout: number, | ||
}, | ||
/** | ||
* Options to pass directly to `chokidar`. | ||
* | ||
* | ||
* @see [chokidar](https://github.com/paulmillr/chokidar#api) | ||
*/ | ||
chokidar: { | ||
/** @default true */ | ||
ignoreInitial: boolean, | ||
}, | ||
}, | ||
/** | ||
* Hooks are listeners to Nuxt events that are typically used in modules, but are also available in `nuxt.config`. | ||
* | ||
* Internally, hooks follow a naming pattern using colons (e.g., build:done). | ||
* For ease of configuration, you can also structure them as an hierarchical object in `nuxt.config` (as below). | ||
* | ||
* | ||
* @example | ||
* ```js'node:fs' | ||
* import fs from 'node:fs' | ||
* import path from 'node:path' | ||
* export default { | ||
* hooks: { | ||
* build: { | ||
* done(builder) { | ||
* const extraFilePath = path.join( | ||
* builder.nuxt.options.buildDir, | ||
* 'extra-file' | ||
* ) | ||
* fs.writeFileSync(extraFilePath, 'Something extra') | ||
* } | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
hooks: NuxtHooks, | ||
/** | ||
* Runtime config allows passing dynamic config and environment variables to the Nuxt app context. | ||
* | ||
* The value of this object is accessible from server only using `useRuntimeConfig`. | ||
* It mainly should hold _private_ configuration which is not exposed on the frontend. This could include a reference to your API secret tokens. | ||
* Anything under `public` and `app` will be exposed to the frontend as well. | ||
* Values are automatically replaced by matching env variables at runtime, e.g. setting an environment variable `NUXT_API_KEY=my-api-key NUXT_PUBLIC_BASE_URL=/foo/` would overwrite the two values in the example below. | ||
* | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* runtimeConfig: { | ||
* apiKey: '' // Default to an empty string, automatically set at runtime using process.env.NUXT_API_KEY | ||
* public: { | ||
* baseURL: '' // Exposed to the frontend as well. | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
runtimeConfig: RuntimeConfig, | ||
/** | ||
* Additional app configuration | ||
* | ||
* For programmatic usage and type support, you can directly provide app config with this option. It will be merged with `app.config` file as default value. | ||
* | ||
*/ | ||
appConfig: AppConfig, | ||
devServer: { | ||
/** | ||
* Whether to enable HTTPS. | ||
* | ||
* @default false | ||
* | ||
* @example | ||
* ```js | ||
* ``` | ||
* import { fileURLToPath } from 'node:url' | ||
* export default { | ||
* modulesDir: ['../../node_modules'] | ||
* server: { | ||
* https: { | ||
* key: fs.readFileSync(fileURLToPath(new URL('./server.key', import.meta.url))), | ||
* cert: fs.readFileSync(fileURLToPath(new URL('./server.crt', import.meta.url))) | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
modulesDir: Array<string>, | ||
https: false | { key: string; cert: string }, | ||
/** | ||
* Whether Nuxt is running in development mode. | ||
* Normally, you should not need to set this. | ||
* @default false | ||
* Dev server listening port | ||
* | ||
* @default 3000 | ||
*/ | ||
dev: boolean, | ||
port: number, | ||
/** | ||
* Whether your app is being unit tested. | ||
* @default false | ||
* Dev server listening host | ||
* | ||
* @default "localhost" | ||
*/ | ||
test: boolean, | ||
host: string, | ||
/** | ||
* Set to `true` to enable debug mode. | ||
* At the moment, it prints out hook names and timings on the server, and logs hook arguments as well in the browser. | ||
* @default false | ||
* Listening dev server url | ||
* | ||
* @default "http://localhost:3000" | ||
*/ | ||
debug: boolean, | ||
url: string, | ||
}, | ||
experimental: { | ||
/** | ||
* Whether to enable rendering of HTML - either dynamically (in server mode) or at generate time. If set to `false` and combined with `static` target, generated pages will simply display a loading screen with no content. | ||
* @default true | ||
* Set to true to generate an async entry point for the Vue bundle (for module federation support). | ||
* | ||
* @default false | ||
*/ | ||
ssr: boolean, | ||
asyncEntry: boolean, | ||
/** | ||
* Modules are Nuxt extensions which can extend its core functionality and add endless integrations. | ||
* Each module is either a string (which can refer to a package, or be a path to a file), a tuple with the module as first string and the options as a second object, or an inline module function. | ||
* Nuxt tries to resolve each item in the modules array using node require path (in `node_modules`) and then will be resolved from project `srcDir` if `~` alias is used. | ||
* Enable Vue's reactivity transform | ||
* | ||
* @note Modules are executed sequentially so the order is important. | ||
* @default false | ||
* | ||
* @example | ||
* ```js | ||
* modules: [ | ||
* // Using package name | ||
* '@nuxtjs/axios', | ||
* // Relative to your project srcDir | ||
* '~/modules/awesome.js', | ||
* // Providing options | ||
* ['@nuxtjs/google-analytics', { ua: 'X1234567' }], | ||
* // Inline definition | ||
* function () {} | ||
* ] | ||
* ``` | ||
* @see https://vuejs.org/guide/extras/reactivity-transform.html | ||
*/ | ||
modules: (NuxtModule | string | [NuxtModule | string, Record<string, any>])[], | ||
reactivityTransform: boolean, | ||
/** | ||
* Customize default directory structure used by Nuxt. | ||
* It is better to stick with defaults unless needed. | ||
* Externalize `vue`, `@vue/*` and `vue-router` when building. | ||
* | ||
* @default true | ||
* | ||
* @see https://github.com/nuxt/nuxt/issues/13632 | ||
*/ | ||
dir: { | ||
/** | ||
* The assets directory (aliased as `~assets` in your build). | ||
* @default "assets" | ||
*/ | ||
assets: string, | ||
externalVue: boolean, | ||
/** | ||
* The layouts directory, each file of which will be auto-registered as a Nuxt layout. | ||
* @default "layouts" | ||
*/ | ||
layouts: string, | ||
/** | ||
* The middleware directory, each file of which will be auto-registered as a Nuxt middleware. | ||
* @default "middleware" | ||
*/ | ||
middleware: string, | ||
/** | ||
* The directory which will be processed to auto-generate your application page routes. | ||
* @default "pages" | ||
*/ | ||
pages: string, | ||
/** | ||
* The plugins directory, each file of which will be auto-registered as a Nuxt plugin. | ||
* @default "plugins" | ||
*/ | ||
plugins: string, | ||
/** | ||
* The directory containing your static files, which will be directly accessible via the Nuxt server and copied across into your `dist` folder when your app is generated. | ||
* @default "public" | ||
*/ | ||
public: string, | ||
/** | ||
* @default "public" | ||
* | ||
* @deprecated use `dir.public` option instead | ||
*/ | ||
static: string, | ||
}, | ||
/** | ||
* The extensions that should be resolved by the Nuxt resolver. | ||
* @default [".js",".jsx",".mjs",".ts",".tsx",".vue"] | ||
* Tree shakes contents of client-only components from server bundle. | ||
* | ||
* @default true | ||
* | ||
* @see https://github.com/nuxt/framework/pull/5750 | ||
*/ | ||
extensions: Array<string>, | ||
treeshakeClientOnly: boolean, | ||
/** | ||
* You can improve your DX by defining additional aliases to access custom directories within your JavaScript and CSS. | ||
* Use vite-node for on-demand server chunk loading | ||
* | ||
* @note Within a webpack context (image sources, CSS - but not JavaScript) you _must_ access | ||
* your alias by prefixing it with `~`. | ||
* @default true | ||
* | ||
* @note These aliases will be automatically added to the generated `.nuxt/tsconfig.json` so you can get full | ||
* type support and path auto-complete. In case you need to extend options provided by `./.nuxt/tsconfig.json` | ||
* further, make sure to add them here or within the `typescript.tsConfig` property in `nuxt.config`. | ||
* @deprecated use `vite.devBundler: 'vite-node'` | ||
*/ | ||
viteNode: boolean, | ||
/** | ||
* Split server bundle into multiple chunks and dynamically import them. | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* alias: { | ||
* 'images': fileURLToPath(new URL('./assets/images', import.meta.url)), | ||
* 'style': fileURLToPath(new URL('./assets/style', import.meta.url)), | ||
* 'data': fileURLToPath(new URL('./assets/other/data', import.meta.url)) | ||
* } | ||
* } | ||
* ``` | ||
* @default true | ||
* | ||
* ```html | ||
* <template> | ||
* <img src="~images/main-bg.jpg"> | ||
* </template> | ||
* @see https://github.com/nuxt/nuxt/issues/14525 | ||
*/ | ||
viteServerDynamicImports: boolean, | ||
/** | ||
* Inline styles when rendering HTML (currently vite only). | ||
* | ||
* <script> | ||
* import data from 'data/test.json' | ||
* </script> | ||
* You can also pass a function that receives the path of a Vue component and returns a boolean indicating whether to inline the styles for that component. | ||
* | ||
* <style> | ||
* // Uncomment the below | ||
* //@import '~style/variables.scss'; | ||
* //@import '~style/utils.scss'; | ||
* //@import '~style/base.scss'; | ||
* body { | ||
* background-image: url('~images/main-bg.jpg'); | ||
* } | ||
* </style> | ||
* ``` | ||
* @default true | ||
*/ | ||
alias: Record<string, string>, | ||
inlineSSRStyles: boolean | ((id?: string) => boolean), | ||
/** | ||
* Pass options directly to `node-ignore` (which is used by Nuxt to ignore files). | ||
* Turn off rendering of Nuxt scripts and JS resource hints. | ||
* | ||
* @see [node-ignore](https://github.com/kaelzhang/node-ignore) | ||
* @default false | ||
*/ | ||
noScripts: boolean, | ||
/** | ||
* When this option is enabled (by default) payload of pages generated with `nuxt generate` are extracted | ||
* | ||
* @example | ||
* ```js | ||
* ignoreOptions: { | ||
* ignorecase: false | ||
* } | ||
* ``` | ||
* @default false | ||
*/ | ||
ignoreOptions: any, | ||
payloadExtraction: boolean, | ||
/** | ||
* Any file in `pages/`, `layouts/`, `middleware/` or `store/` will be ignored during building if its filename starts with the prefix specified by `ignorePrefix`. | ||
* @default "-" | ||
* Enable cross-origin prefetch using the Speculation Rules API. | ||
* | ||
* @default false | ||
*/ | ||
ignorePrefix: string, | ||
crossOriginPrefetch: boolean, | ||
/** | ||
* More customizable than `ignorePrefix`: all files matching glob patterns specified inside the `ignore` array will be ignored in building. | ||
* @default ["**\/*.stories.{js,ts,jsx,tsx}","**\/*.{spec,test}.{js,ts,jsx,tsx}","**\/*.d.ts",".output","**\/-*.*"] | ||
* Write early hints when using node server. | ||
* | ||
* @default false | ||
* | ||
* @note nginx does not support 103 Early hints in the current version. | ||
*/ | ||
ignore: Array<string>, | ||
writeEarlyHints: boolean, | ||
/** The watchers property lets you overwrite watchers configuration in your `nuxt.config`. */ | ||
watchers: { | ||
/** An array of event types, which, when received, will cause the watcher to restart. */ | ||
rewatchOnRawEvents: any, | ||
/** | ||
* Experimental component islands support with <NuxtIsland> and .island.vue files. | ||
* | ||
* @default false | ||
*/ | ||
componentIslands: boolean, | ||
/** | ||
* `watchOptions` to pass directly to webpack. | ||
* | ||
* @see [webpack@4 watch options](https://v4.webpack.js.org/configuration/watch/#watchoptions). | ||
*/ | ||
webpack: { | ||
/** @default 1000 */ | ||
aggregateTimeout: number, | ||
}, | ||
/** | ||
* Options to pass directly to `chokidar`. | ||
* | ||
* @see [chokidar](https://github.com/paulmillr/chokidar#api) | ||
*/ | ||
chokidar: { | ||
/** @default true */ | ||
ignoreInitial: boolean, | ||
}, | ||
}, | ||
/** | ||
* Hooks are listeners to Nuxt events that are typically used in modules, but are also available in `nuxt.config`. | ||
* Internally, hooks follow a naming pattern using colons (e.g., build:done). | ||
* For ease of configuration, you can also structure them as an hierarchical object in `nuxt.config` (as below). | ||
* Enable experimental config schema support | ||
* | ||
* @example | ||
* ```js'node:fs' | ||
* import fs from 'node:fs' | ||
* import path from 'node:path' | ||
* export default { | ||
* hooks: { | ||
* build: { | ||
* done(builder) { | ||
* const extraFilePath = path.join( | ||
* builder.nuxt.options.buildDir, | ||
* 'extra-file' | ||
* ) | ||
* fs.writeFileSync(extraFilePath, 'Something extra') | ||
* } | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
* @default false | ||
* | ||
* @see https://github.com/nuxt/nuxt/issues/15592 | ||
*/ | ||
hooks: NuxtHooks, | ||
configSchema: boolean, | ||
}, | ||
generate: { | ||
/** | ||
* Runtime config allows passing dynamic config and environment variables to the Nuxt app context. | ||
* The value of this object is accessible from server only using `useRuntimeConfig`. | ||
* It mainly should hold _private_ configuration which is not exposed on the frontend. This could include a reference to your API secret tokens. | ||
* Anything under `public` and `app` will be exposed to the frontend as well. | ||
* Values are automatically replaced by matching env variables at runtime, e.g. setting an environment variable `NUXT_API_KEY=my-api-key NUXT_PUBLIC_BASE_URL=/foo/` would overwrite the two values in the example below. | ||
* The routes to generate. | ||
* | ||
* If you are using the crawler, this will be only the starting point for route generation. This is often necessary when using dynamic routes. | ||
* It is preferred to use `nitro.prerender.routes`. | ||
* | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* runtimeConfig: { | ||
* apiKey: '' // Default to an empty string, automatically set at runtime using process.env.NUXT_API_KEY | ||
* public: { | ||
* baseURL: '' // Exposed to the frontend as well. | ||
* } | ||
* } | ||
* } | ||
* routes: ['/users/1', '/users/2', '/users/3'] | ||
* ``` | ||
*/ | ||
runtimeConfig: RuntimeConfig, | ||
routes: Array<any>, | ||
/** | ||
* Additional app configuration | ||
* For programmatic usage and type support, you can directly provide app config with this option. It will be merged with `app.config` file as default value. | ||
* This option is no longer used. Instead, use `nitro.prerender.ignore`. | ||
* | ||
*/ | ||
appConfig: AppConfig, | ||
exclude: Array<any>, | ||
}, | ||
devServer: { | ||
/** | ||
* Whether to enable HTTPS. | ||
* @default false | ||
* | ||
* @example | ||
* ``` | ||
* import { fileURLToPath } from 'node:url' | ||
* export default { | ||
* server: { | ||
* https: { | ||
* key: fs.readFileSync(fileURLToPath(new URL('./server.key', import.meta.url))), | ||
* cert: fs.readFileSync(fileURLToPath(new URL('./server.crt', import.meta.url))) | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
https: false | { key: string; cert: string }, | ||
/** | ||
* @default 3 | ||
* | ||
* @private | ||
*/ | ||
_majorVersion: number, | ||
/** | ||
* Dev server listening port | ||
* @default 3000 | ||
*/ | ||
port: number, | ||
/** | ||
* @default false | ||
* | ||
* @private | ||
*/ | ||
_legacyGenerate: boolean, | ||
/** | ||
* Dev server listening host | ||
* @default "localhost" | ||
*/ | ||
host: string, | ||
/** | ||
* @default false | ||
* | ||
* @private | ||
*/ | ||
_start: boolean, | ||
/** | ||
* Listening dev server url | ||
* @default "http://localhost:3000" | ||
*/ | ||
url: string, | ||
}, | ||
/** | ||
* @default false | ||
* | ||
* @private | ||
*/ | ||
_build: boolean, | ||
experimental: { | ||
/** | ||
* Set to true to generate an async entry point for the Vue bundle (for module federation support). | ||
* @default false | ||
*/ | ||
asyncEntry: boolean, | ||
/** | ||
* @default false | ||
* | ||
* @private | ||
*/ | ||
_generate: boolean, | ||
/** | ||
* Enable Vue's reactivity transform | ||
* @default false | ||
* | ||
* @see https://vuejs.org/guide/extras/reactivity-transform.html | ||
*/ | ||
reactivityTransform: boolean, | ||
/** | ||
* @default false | ||
* | ||
* @private | ||
*/ | ||
_prepare: boolean, | ||
/** | ||
* Externalize `vue`, `@vue/*` and `vue-router` when building. | ||
* @default true | ||
* | ||
* @see https://github.com/nuxt/framework/issues/4084 | ||
*/ | ||
externalVue: boolean, | ||
/** | ||
* @default false | ||
* | ||
* @private | ||
*/ | ||
_cli: boolean, | ||
/** | ||
* Tree shakes contents of client-only components from server bundle. | ||
* @default true | ||
* | ||
* @see https://github.com/nuxt/framework/pull/5750 | ||
*/ | ||
treeshakeClientOnly: boolean, | ||
/** | ||
* | ||
* @private | ||
*/ | ||
_requiredModules: any, | ||
/** | ||
* Use vite-node for on-demand server chunk loading | ||
* @default true | ||
* | ||
* @deprecated use `vite.devBundler: 'vite-node'` | ||
*/ | ||
viteNode: boolean, | ||
/** | ||
* | ||
* @private | ||
*/ | ||
_nuxtConfigFile: any, | ||
/** | ||
* Split server bundle into multiple chunks and dynamically import them. | ||
* @default true | ||
* | ||
* @see https://github.com/nuxt/framework/issues/6432 | ||
*/ | ||
viteServerDynamicImports: boolean, | ||
/** | ||
* | ||
* @private | ||
*/ | ||
_nuxtConfigFiles: Array<any>, | ||
/** | ||
* Inline styles when rendering HTML (currently vite only). | ||
* You can also pass a function that receives the path of a Vue component and returns a boolean indicating whether to inline the styles for that component. | ||
* @default true | ||
*/ | ||
inlineSSRStyles: boolean | ((id?: string) => boolean), | ||
/** | ||
* @default "" | ||
* | ||
* @private | ||
*/ | ||
appDir: string, | ||
/** | ||
* Turn off rendering of Nuxt scripts and JS resource hints. | ||
* @default false | ||
*/ | ||
noScripts: boolean, | ||
/** | ||
* | ||
* @private | ||
*/ | ||
_installedModules: Array<any>, | ||
/** | ||
* When this option is enabled (by default) payload of pages generated with `nuxt generate` are extracted | ||
* @default false | ||
*/ | ||
payloadExtraction: boolean, | ||
/** | ||
* | ||
* @private | ||
*/ | ||
_modules: Array<any>, | ||
/** | ||
* Enable cross-origin prefetch using the Speculation Rules API. | ||
* @default false | ||
*/ | ||
crossOriginPrefetch: boolean, | ||
/** | ||
* Configuration for Nitro. | ||
* | ||
* | ||
* @see https://nitro.unjs.io/config/ | ||
*/ | ||
nitro: NitroConfig, | ||
/** | ||
* Write early hints when using node server. | ||
* @default false | ||
* | ||
* @note nginx does not support 103 Early hints in the current version. | ||
*/ | ||
writeEarlyHints: boolean, | ||
}, | ||
/** | ||
* Global route options applied to matching server routes. | ||
* | ||
* | ||
* @experimental This is an experimental feature and API may change in the future. | ||
* | ||
* @see https://nitro.unjs.io/config/#routes | ||
*/ | ||
routeRules: NitroConfig['routeRules'], | ||
generate: { | ||
/** | ||
* The routes to generate. | ||
* If you are using the crawler, this will be only the starting point for route generation. This is often necessary when using dynamic routes. | ||
* It can be an array or a function. | ||
* | ||
* @example | ||
* ```js | ||
* routes: ['/users/1', '/users/2', '/users/3'] | ||
* ``` | ||
* | ||
* You can pass a function that returns a promise or a function that takes a callback. It should | ||
* return an array of strings or objects with `route` and (optional) `payload` keys. | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* generate: { | ||
* async routes() { | ||
* const res = await axios.get('https://my-api/users') | ||
* return res.data.map(user => ({ route: '/users/' + user.id, payload: user })) | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
* Or instead: | ||
* ```js | ||
* export default { | ||
* generate: { | ||
* routes(callback) { | ||
* axios | ||
* .get('https://my-api/users') | ||
* .then(res => { | ||
* const routes = res.data.map(user => '/users/' + user.id) | ||
* callback(null, routes) | ||
* }) | ||
* .catch(callback) | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
* | ||
* If `routes()` returns a payload, it can be accessed from the Nuxt context. | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* async useAsyncData ({ params, error, payload }) { | ||
* if (payload) return { user: payload } | ||
* else return { user: await backend.fetchUser(params.id) } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
routes: Array<any>, | ||
/** | ||
* Nitro server handlers. | ||
* | ||
* Each handler accepts the following options: - handler: The path to the file defining the handler. - route: The route under which the handler is available. This follows the conventions of https://github.com/unjs/radix3. - method: The HTTP method of requests that should be handled. - middleware: Specifies whether it is a middleware handler. - lazy: Specifies whether to use lazy loading to import the handler. | ||
* | ||
* | ||
* @see https://nuxt.com/docs/guide/directory-structure/server | ||
* | ||
* @note Files from `server/api`, `server/middleware` and `server/routes` will be automatically registered by Nuxt. | ||
* | ||
* @example | ||
* ```js | ||
* serverHandlers: [ | ||
* { route: '/path/foo/**:name', handler: '~/server/foohandler.ts' } | ||
* ] | ||
* ``` | ||
*/ | ||
serverHandlers: NitroEventHandler[], | ||
/** An array of string or regular expressions that will prevent generation of routes matching them. The routes will still be accessible when `fallback` is set. */ | ||
exclude: Array<any>, | ||
}, | ||
/** | ||
* Nitro development-only server handlers. | ||
* | ||
* | ||
* @see https://nitro.unjs.io/guide/introduction/routing | ||
*/ | ||
devServerHandlers: NitroDevEventHandler[], | ||
postcss: { | ||
/** | ||
* @default 3 | ||
* Options for configuring PostCSS plugins. | ||
* | ||
* @private | ||
* https://postcss.org/ | ||
* | ||
*/ | ||
_majorVersion: number, | ||
plugins: Record<string, any>, | ||
}, | ||
router: { | ||
/** | ||
* @default false | ||
* Additional options passed to `vue-router`. | ||
* | ||
* @private | ||
* Note: Only JSON serializable options should be passed by nuxt config. | ||
* For more control, you can use `app/router.options.ts` file. | ||
* | ||
* | ||
* @see [documentation](https://router.vuejs.org/api/interfaces/routeroptions.html). | ||
*/ | ||
_legacyGenerate: boolean, | ||
options: RouterConfigSerializable, | ||
}, | ||
/** | ||
* Configuration for Nuxt's TypeScript integration. | ||
* | ||
*/ | ||
typescript: { | ||
/** | ||
* @default false | ||
* TypeScript comes with certain checks to give you more safety and analysis of your program. Once you’ve converted your codebase to TypeScript, you can start enabling these checks for greater safety. [Read More](https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html#getting-stricter-checks) | ||
* | ||
* @private | ||
* @default true | ||
*/ | ||
_start: boolean, | ||
strict: boolean, | ||
/** | ||
* @default false | ||
* Include parent workspace in the Nuxt project. Mostly useful for themes and module authors. | ||
* | ||
* @private | ||
*/ | ||
_build: boolean, | ||
/** | ||
* @default false | ||
* | ||
* @private | ||
*/ | ||
_generate: boolean, | ||
includeWorkspace: boolean, | ||
/** | ||
* @default false | ||
* Enable build-time type checking. | ||
* | ||
* @private | ||
*/ | ||
_prepare: boolean, | ||
/** | ||
* 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 to install `typescript` and `vue-tsc` as dev dependencies. | ||
* | ||
* @default false | ||
* | ||
* @private | ||
* @see https://nuxt.com/docs/guide/concepts/typescript | ||
*/ | ||
_cli: boolean, | ||
typeCheck: boolean | 'build', | ||
/** | ||
* You can extend generated `.nuxt/tsconfig.json` using this option. | ||
* | ||
* @private | ||
*/ | ||
_requiredModules: any, | ||
tsConfig: readPackageJSON, | ||
/** | ||
* Generate a `*.vue` shim. | ||
* | ||
* @private | ||
*/ | ||
_nuxtConfigFile: any, | ||
/** | ||
* We recommend instead either enabling [**Take Over Mode**](https://vuejs.org/guide/typescript/overview.html#volar-takeover-mode) or adding TypeScript Vue Plugin (Volar)** 👉 [[Download](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin)]. | ||
* | ||
* @private | ||
* @default true | ||
*/ | ||
_nuxtConfigFiles: Array<any>, | ||
shim: boolean, | ||
}, | ||
/** | ||
* Configuration that will be passed directly to Vite. | ||
* | ||
* See https://vitejs.dev/config for more information. Please note that not all vite options are supported in Nuxt. | ||
* | ||
*/ | ||
vite: ViteConfig, | ||
webpack: { | ||
/** | ||
* @default "" | ||
* Nuxt uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them. | ||
* | ||
* @private | ||
* Set to `true` to enable bundle analysis, or pass an object with options: [for webpack](https://github.com/webpack-contrib/webpack-bundle-analyzer#options-for-plugin) or [for vite](https://github.com/btd/rollup-plugin-visualizer#options). | ||
* | ||
* @default false | ||
* | ||
* @example | ||
* ```js | ||
* analyze: { | ||
* analyzerMode: 'static' | ||
* } | ||
* ``` | ||
*/ | ||
appDir: string, | ||
analyze: boolean | BundleAnalyzerPlugin.Options, | ||
/** | ||
* Enable the profiler in webpackbar. | ||
* | ||
* @private | ||
* It is normally enabled by CLI argument `--profile`. | ||
* | ||
* @default false | ||
* | ||
* @see [webpackbar](https://github.com/unjs/webpackbar#profile). | ||
*/ | ||
_installedModules: Array<any>, | ||
profile: boolean, | ||
/** | ||
* Enables Common CSS Extraction using [Vue Server Renderer guidelines](https://ssr.vuejs.org/guide/css.html). | ||
* | ||
* @private | ||
* Using [extract-css-chunks-webpack-plugin](https://github.com/faceyspacey/extract-css-chunks-webpack-plugin/) under the hood, your CSS will be extracted into separate files, usually one per component. This allows caching your CSS and JavaScript separately and is worth trying if you have a lot of global or shared CSS. | ||
* | ||
* @default true | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* webpack: { | ||
* extractCSS: true, | ||
* // or | ||
* extractCSS: { | ||
* ignoreOrder: true | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
* | ||
* If you want to extract all your CSS to a single file, there is a workaround for this. | ||
* However, note that it is not recommended to extract everything into a single file. | ||
* Extracting into multiple CSS files is better for caching and preload isolation. It | ||
* can also improve page performance by downloading and resolving only those resources | ||
* that are needed. | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* webpack: { | ||
* extractCSS: true, | ||
* optimization: { | ||
* splitChunks: { | ||
* cacheGroups: { | ||
* styles: { | ||
* name: 'styles', | ||
* test: /\.(css|vue)$/, | ||
* chunks: 'all', | ||
* enforce: true | ||
* } | ||
* } | ||
* } | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
_modules: Array<any>, | ||
extractCSS: boolean | PluginOptions, | ||
/** | ||
* Configuration for Nitro. | ||
* Enables CSS source map support (defaults to `true` in development). | ||
* | ||
* @see https://nitro.unjs.io/config/ | ||
* @default false | ||
*/ | ||
nitro: NitroConfig, | ||
cssSourceMap: boolean, | ||
/** | ||
* Global route options applied to matching server routes. | ||
* The polyfill library to load to provide URL and URLSearchParams. | ||
* | ||
* @experimental This is an experimental feature and API may change in the future. | ||
* Defaults to `'url'` ([see package](https://www.npmjs.com/package/url)). | ||
* | ||
* @see https://nitro.unjs.io/config/#routes | ||
* @default "url" | ||
*/ | ||
routeRules: NitroConfig['routeRules'], | ||
serverURLPolyfill: string, | ||
/** | ||
* Nitro server handlers. | ||
* Each handler accepts the following options: - handler: The path to the file defining the handler. - route: The route under which the handler is available. This follows the conventions of https://github.com/unjs/radix3. - method: The HTTP method of requests that should be handled. - middleware: Specifies whether it is a middleware handler. - lazy: Specifies whether to use lazy loading to import the handler. | ||
* Customize bundle filenames. | ||
* | ||
* @see https://v3.nuxtjs.org/guide/features/server-routes | ||
* To understand a bit more about the use of manifests, take a look at [this webpack documentation](https://webpack.js.org/guides/code-splitting/). | ||
* | ||
* @note Files from `server/api`, `server/middleware` and `server/routes` will be automatically registered by Nuxt. | ||
* | ||
* @note Be careful when using non-hashed based filenames in production | ||
* as most browsers will cache the asset and not detect the changes on first load. | ||
* | ||
* This example changes fancy chunk names to numerical ids: | ||
* | ||
* @example | ||
* ```js | ||
* serverHandlers: [ | ||
* { route: '/path/foo/**:name', handler: '~/server/foohandler.ts' } | ||
* ] | ||
* filenames: { | ||
* chunk: ({ isDev }) => (isDev ? '[name].js' : '[id].[contenthash].js') | ||
* } | ||
* ``` | ||
*/ | ||
serverHandlers: NitroEventHandler[], | ||
filenames: { | ||
app: () => any, | ||
/** | ||
* Nitro development-only server handlers. | ||
* | ||
* @see https://nitro.unjs.io/guide/introduction/routing | ||
*/ | ||
devServerHandlers: NitroDevEventHandler[], | ||
chunk: () => any, | ||
postcss: { | ||
/** | ||
* Path to postcss config file. | ||
* @default false | ||
*/ | ||
config: boolean, | ||
css: () => any, | ||
/** | ||
* Options for configuring PostCSS plugins. | ||
* https://postcss.org/ | ||
*/ | ||
plugins: Record<string, any>, | ||
}, | ||
img: () => any, | ||
router: { | ||
/** | ||
* Additional options passed to `vue-router`. | ||
* Note: Only JSON serializable options should be passed by nuxt config. | ||
* For more control, you can use `app/router.options.ts` file. | ||
* | ||
* @see [documentation](https://router.vuejs.org/api/interfaces/routeroptions.html). | ||
*/ | ||
options: RouterConfigSerializable, | ||
}, | ||
font: () => any, | ||
/** Configuration for Nuxt's TypeScript integration. */ | ||
typescript: { | ||
/** | ||
* TypeScript comes with certain checks to give you more safety and analysis of your program. Once you’ve converted your codebase to TypeScript, you can start enabling these checks for greater safety. [Read More](https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html#getting-stricter-checks) | ||
* @default true | ||
*/ | ||
strict: boolean, | ||
/** | ||
* Include parent workspace in the Nuxt project. Mostly useful for themes and module authors. | ||
* @default false | ||
*/ | ||
includeWorkspace: boolean, | ||
/** | ||
* Enable build-time type checking. | ||
* 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 to install `typescript` and `vue-tsc` as dev dependencies. | ||
* @default false | ||
* | ||
* @see https://v3.nuxtjs.org/guide/concepts/typescript#type-checking | ||
*/ | ||
typeCheck: boolean | 'build', | ||
/** You can extend generated `.nuxt/tsconfig.json` using this option. */ | ||
tsConfig: readPackageJSON, | ||
/** | ||
* Generate a `*.vue` shim. | ||
* We recommend instead either enabling [**Take Over Mode**](https://vuejs.org/guide/typescript/overview.html#volar-takeover-mode) or adding TypeScript Vue Plugin (Volar)** 👉 [[Download](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin)]. | ||
* @default true | ||
*/ | ||
shim: boolean, | ||
video: () => any, | ||
}, | ||
/** | ||
* Configuration that will be passed directly to Vite. | ||
* See https://vitejs.dev/config for more information. Please note that not all vite options are supported in Nuxt. | ||
* Customize the options of Nuxt's integrated webpack loaders. | ||
* | ||
*/ | ||
vite: ViteConfig, | ||
loaders: { | ||
file: { | ||
/** @default false */ | ||
esModule: boolean, | ||
}, | ||
webpack: { | ||
/** | ||
* Nuxt uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them. | ||
* Set to `true` to enable bundle analysis, or pass an object with options: [for webpack](https://github.com/webpack-contrib/webpack-bundle-analyzer#options-for-plugin) or [for vite](https://github.com/btd/rollup-plugin-visualizer#options). | ||
* @default false | ||
* | ||
* @example | ||
* ```js | ||
* analyze: { | ||
* analyzerMode: 'static' | ||
* } | ||
* ``` | ||
*/ | ||
analyze: boolean | BundleAnalyzerPlugin.Options, | ||
fontUrl: { | ||
/** @default false */ | ||
esModule: boolean, | ||
/** | ||
* Enable the profiler in webpackbar. | ||
* It is normally enabled by CLI argument `--profile`. | ||
* @default false | ||
* | ||
* @see [webpackbar](https://github.com/unjs/webpackbar#profile). | ||
*/ | ||
profile: boolean, | ||
/** @default 1000 */ | ||
limit: number, | ||
}, | ||
/** | ||
* Enables Common CSS Extraction using [Vue Server Renderer guidelines](https://ssr.vuejs.org/guide/css.html). | ||
* Using [extract-css-chunks-webpack-plugin](https://github.com/faceyspacey/extract-css-chunks-webpack-plugin/) under the hood, your CSS will be extracted into separate files, usually one per component. This allows caching your CSS and JavaScript separately and is worth trying if you have a lot of global or shared CSS. | ||
* @default true | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* webpack: { | ||
* extractCSS: true, | ||
* // or | ||
* extractCSS: { | ||
* ignoreOrder: true | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
* | ||
* If you want to extract all your CSS to a single file, there is a workaround for this. | ||
* However, note that it is not recommended to extract everything into a single file. | ||
* Extracting into multiple CSS files is better for caching and preload isolation. It | ||
* can also improve page performance by downloading and resolving only those resources | ||
* that are needed. | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* webpack: { | ||
* extractCSS: true, | ||
* optimization: { | ||
* splitChunks: { | ||
* cacheGroups: { | ||
* styles: { | ||
* name: 'styles', | ||
* test: /\.(css|vue)$/, | ||
* chunks: 'all', | ||
* enforce: true | ||
* } | ||
* } | ||
* } | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
extractCSS: boolean | PluginOptions, | ||
imgUrl: { | ||
/** @default false */ | ||
esModule: boolean, | ||
/** | ||
* Enables CSS source map support (defaults to `true` in development). | ||
* @default false | ||
*/ | ||
cssSourceMap: boolean, | ||
/** @default 1000 */ | ||
limit: number, | ||
}, | ||
/** | ||
* The polyfill library to load to provide URL and URLSearchParams. | ||
* Defaults to `'url'` ([see package](https://www.npmjs.com/package/url)). | ||
* @default "url" | ||
*/ | ||
serverURLPolyfill: string, | ||
pugPlain: any, | ||
/** | ||
* Customize bundle filenames. | ||
* To understand a bit more about the use of manifests, take a look at [this webpack documentation](https://webpack.js.org/guides/code-splitting/). | ||
* | ||
* @note Be careful when using non-hashed based filenames in production | ||
* as most browsers will cache the asset and not detect the changes on first load. | ||
* | ||
* This example changes fancy chunk names to numerical ids: | ||
* | ||
* @example | ||
* ```js | ||
* filenames: { | ||
* chunk: ({ isDev }) => (isDev ? '[name].js' : '[id].[contenthash].js') | ||
* } | ||
* ``` | ||
*/ | ||
filenames: { | ||
app: () => any, | ||
vue: { | ||
/** @default true */ | ||
productionMode: boolean, | ||
chunk: () => any, | ||
transformAssetUrls: { | ||
/** @default "src" */ | ||
video: string, | ||
css: () => any, | ||
/** @default "src" */ | ||
source: string, | ||
img: () => any, | ||
/** @default "src" */ | ||
object: string, | ||
font: () => any, | ||
/** @default "src" */ | ||
embed: string, | ||
}, | ||
video: () => any, | ||
compilerOptions: { | ||
[key: string]: any | ||
}, | ||
}, | ||
/** Customize the options of Nuxt's integrated webpack loaders. */ | ||
loaders: { | ||
file: { | ||
/** @default false */ | ||
esModule: boolean, | ||
}, | ||
css: { | ||
/** @default 0 */ | ||
importLoaders: number, | ||
fontUrl: { | ||
/** @default false */ | ||
esModule: boolean, | ||
url: { | ||
filter: () => any, | ||
}, | ||
/** @default 1000 */ | ||
limit: number, | ||
}, | ||
/** @default false */ | ||
esModule: boolean, | ||
}, | ||
imgUrl: { | ||
/** @default false */ | ||
esModule: boolean, | ||
cssModules: { | ||
/** @default 0 */ | ||
importLoaders: number, | ||
/** @default 1000 */ | ||
limit: number, | ||
}, | ||
url: { | ||
filter: () => any, | ||
}, | ||
pugPlain: any, | ||
/** @default false */ | ||
esModule: boolean, | ||
vue: { | ||
/** @default true */ | ||
productionMode: boolean, | ||
modules: { | ||
/** @default "[local]_[hash:base64:5]" */ | ||
localIdentName: string, | ||
}, | ||
}, | ||
transformAssetUrls: { | ||
/** @default "src" */ | ||
video: string, | ||
less: any, | ||
/** @default "src" */ | ||
source: string, | ||
sass: { | ||
sassOptions: { | ||
/** @default true */ | ||
indentedSyntax: boolean, | ||
}, | ||
}, | ||
/** @default "src" */ | ||
object: string, | ||
scss: any, | ||
/** @default "src" */ | ||
embed: string, | ||
}, | ||
stylus: any, | ||
compilerOptions: { | ||
[key: string]: any | ||
}, | ||
}, | ||
vueStyle: any, | ||
}, | ||
css: { | ||
/** @default 0 */ | ||
importLoaders: number, | ||
/** | ||
* Add webpack plugins. | ||
* | ||
* | ||
* @example | ||
* ```js | ||
* import webpack from 'webpack' | ||
* import { version } from './package.json' | ||
* // ... | ||
* plugins: [ | ||
* new webpack.DefinePlugin({ | ||
* 'process.VERSION': version | ||
* }) | ||
* ] | ||
* ``` | ||
*/ | ||
plugins: Array<any>, | ||
url: { | ||
filter: () => any, | ||
}, | ||
/** | ||
* Terser plugin options. | ||
* | ||
* Set to false to disable this plugin, or pass an object of options. | ||
* | ||
* | ||
* @see [terser-webpack-plugin documentation](https://github.com/webpack-contrib/terser-webpack-plugin). | ||
* | ||
* @note Enabling sourceMap will leave `//# sourceMappingURL` linking comment at | ||
* the end of each output file if webpack `config.devtool` is set to `source-map`. | ||
*/ | ||
terser: false | BasePluginOptions & DefinedDefaultMinimizerAndOptions<any>, | ||
/** @default false */ | ||
esModule: boolean, | ||
}, | ||
/** | ||
* Hard-replaces `typeof process`, `typeof window` and `typeof document` to tree-shake bundle. | ||
* | ||
* @default false | ||
*/ | ||
aggressiveCodeRemoval: boolean, | ||
cssModules: { | ||
/** @default 0 */ | ||
importLoaders: number, | ||
/** | ||
* OptimizeCSSAssets plugin options. | ||
* | ||
* Defaults to true when `extractCSS` is enabled. | ||
* | ||
* @default false | ||
* | ||
* @see [css-minimizer-webpack-plugin documentation](https://github.com/webpack-contrib/css-minimizer-webpack-plugin). | ||
*/ | ||
optimizeCSS: false | BasePluginOptions$1 & DefinedDefaultMinimizerAndOptions$1<any>, | ||
url: { | ||
filter: () => any, | ||
}, | ||
/** | ||
* Configure [webpack optimization](https://webpack.js.org/configuration/optimization/). | ||
* | ||
*/ | ||
optimization: false | Configuration['optimization'], | ||
/** @default false */ | ||
esModule: boolean, | ||
/** | ||
* Customize PostCSS Loader. Same options as https://github.com/webpack-contrib/postcss-loader#options | ||
* | ||
*/ | ||
postcss: { | ||
execute: any, | ||
modules: { | ||
/** @default "[local]_[hash:base64:5]" */ | ||
localIdentName: string, | ||
}, | ||
}, | ||
postcssOptions: { | ||
config: any, | ||
less: any, | ||
sass: { | ||
sassOptions: { | ||
/** @default true */ | ||
indentedSyntax: boolean, | ||
}, | ||
}, | ||
scss: any, | ||
stylus: any, | ||
vueStyle: any, | ||
plugins: { | ||
[key: string]: any | ||
}, | ||
}, | ||
/** | ||
* Add webpack plugins. | ||
* | ||
* @example | ||
* ```js | ||
* import webpack from 'webpack' | ||
* import { version } from './package.json' | ||
* // ... | ||
* plugins: [ | ||
* new webpack.DefinePlugin({ | ||
* 'process.VERSION': version | ||
* }) | ||
* ] | ||
* ``` | ||
*/ | ||
plugins: Array<any>, | ||
sourceMap: any, | ||
/** | ||
* Terser plugin options. | ||
* Set to false to disable this plugin, or pass an object of options. | ||
* | ||
* @see [terser-webpack-plugin documentation](https://github.com/webpack-contrib/terser-webpack-plugin). | ||
* | ||
* @note Enabling sourceMap will leave `//# sourceMappingURL` linking comment at | ||
* the end of each output file if webpack `config.devtool` is set to `source-map`. | ||
*/ | ||
terser: false | BasePluginOptions & DefinedDefaultMinimizerAndOptions<any>, | ||
implementation: any, | ||
/** | ||
* Hard-replaces `typeof process`, `typeof window` and `typeof document` to tree-shake bundle. | ||
* @default false | ||
*/ | ||
aggressiveCodeRemoval: boolean, | ||
/** @default "" */ | ||
order: string, | ||
}, | ||
/** | ||
* OptimizeCSSAssets plugin options. | ||
* Defaults to true when `extractCSS` is enabled. | ||
* @default false | ||
* | ||
* @see [css-minimizer-webpack-plugin documentation](https://github.com/webpack-contrib/css-minimizer-webpack-plugin). | ||
*/ | ||
optimizeCSS: false | BasePluginOptions$1 & DefinedDefaultMinimizerAndOptions$1<any>, | ||
/** | ||
* See [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) for available options. | ||
* | ||
*/ | ||
devMiddleware: Options<IncomingMessage, ServerResponse>, | ||
/** Configure [webpack optimization](https://webpack.js.org/configuration/optimization/). */ | ||
optimization: false | Configuration['optimization'], | ||
/** | ||
* See [webpack-hot-middleware](https://github.com/webpack-contrib/webpack-hot-middleware) for available options. | ||
* | ||
*/ | ||
hotMiddleware: MiddlewareOptions & { client?: ClientOptions }, | ||
/** Customize PostCSS Loader. Same options as https://github.com/webpack-contrib/postcss-loader#options */ | ||
postcss: { | ||
execute: any, | ||
/** | ||
* Set to `false` to disable the overlay provided by [FriendlyErrorsWebpackPlugin](https://github.com/nuxt/friendly-errors-webpack-plugin). | ||
* | ||
* @default true | ||
*/ | ||
friendlyErrors: boolean, | ||
postcssOptions: { | ||
/** @default false */ | ||
config: boolean, | ||
plugins: { | ||
[key: string]: any | ||
}, | ||
}, | ||
sourceMap: any, | ||
implementation: any, | ||
/** @default "" */ | ||
order: string, | ||
}, | ||
/** See [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) for available options. */ | ||
devMiddleware: Options<IncomingMessage, ServerResponse>, | ||
/** See [webpack-hot-middleware](https://github.com/webpack-contrib/webpack-hot-middleware) for available options. */ | ||
hotMiddleware: MiddlewareOptions & { client?: ClientOptions }, | ||
/** | ||
* Set to `false` to disable the overlay provided by [FriendlyErrorsWebpackPlugin](https://github.com/nuxt/friendly-errors-webpack-plugin). | ||
* @default true | ||
*/ | ||
friendlyErrors: boolean, | ||
/** Filters to hide build warnings. */ | ||
warningIgnoreFilters: Array<(warn: WebpackError) => boolean>, | ||
}, | ||
/** | ||
* Filters to hide build warnings. | ||
* | ||
*/ | ||
warningIgnoreFilters: Array<(warn: WebpackError) => boolean>, | ||
}, | ||
} | ||
@@ -1904,2 +2062,8 @@ | ||
vite?: ConfigSchema['vite']; | ||
/** | ||
* Experimental custom config schema | ||
* | ||
* @see https://github.com/nuxt/nuxt/issues/15592 | ||
*/ | ||
$schema?: SchemaDefinition; | ||
} | ||
@@ -1922,2 +2086,3 @@ interface ConfigLayer<T> { | ||
_layers: NuxtConfigLayer[]; | ||
$schema: SchemaDefinition; | ||
} | ||
@@ -1924,0 +2089,0 @@ interface ViteConfig extends UserConfig { |
{ | ||
"name": "@nuxt/schema", | ||
"version": "3.0.0", | ||
"repository": "nuxt/framework", | ||
"version": "3.1.0", | ||
"repository": "nuxt/nuxt", | ||
"license": "MIT", | ||
@@ -15,14 +15,15 @@ "type": "module", | ||
"@types/lodash.template": "^4", | ||
"@types/semver": "^7", | ||
"@vitejs/plugin-vue": "^3.2.0", | ||
"@unhead/schema": "^1.0.0", | ||
"nitropack": "^1.0.0", | ||
"@types/semver": "^7.3.13", | ||
"@unhead/schema": "^1.0.18", | ||
"@vitejs/plugin-vue": "^4.0.0", | ||
"nitropack": "^2.0.0", | ||
"unbuild": "latest", | ||
"vite": "~3.2.4" | ||
"vite": "~4.0.4" | ||
}, | ||
"dependencies": { | ||
"c12": "^1.0.1", | ||
"c12": "^1.1.0", | ||
"create-require": "^1.1.1", | ||
"defu": "^6.1.1", | ||
"jiti": "^1.16.0", | ||
"hookable": "^5.4.2", | ||
"jiti": "^1.16.2", | ||
"pathe": "^1.0.0", | ||
@@ -33,5 +34,5 @@ "pkg-types": "^1.0.1", | ||
"std-env": "^3.3.1", | ||
"ufo": "^1.0.0", | ||
"unimport": "^1.0.1", | ||
"untyped": "^1.0.0" | ||
"ufo": "^1.0.1", | ||
"unimport": "^2.0.1", | ||
"untyped": "^1.2.2" | ||
}, | ||
@@ -38,0 +39,0 @@ "engines": { |
129
README.md
@@ -1,3 +0,128 @@ | ||
# Nuxt Schema | ||
> Cross-version Nuxt typedefs and defaults | ||
[![Nuxt banner](./.github/assets/banner.png)](https://nuxt.com) | ||
# 👋 Welcome to Nuxt | ||
Nuxt's goal is to make web development intuitive and performant, with a great developer experience.<br>Learn more in the ['What is Nuxt?'](https://nuxt.com/docs/getting-started/introduction) section of our documentation. | ||
<p> | ||
<a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/v/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="Version"></a> | ||
<a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/dm/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="Downloads"></a> | ||
<a href="./LICENSE"><img src="https://img.shields.io/github/license/nuxt/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="License"></a> | ||
<a href="https://volta.net/nuxt/nuxt?utm_source=nuxt_readme"><img src="https://user-images.githubusercontent.com/904724/209143798-32345f6c-3cf8-4e06-9659-f4ace4a6acde.svg" alt="Volta board"></a> | ||
</p> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th width="2000" colspan="2"> | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td width="80" align="center" valign="top"> | ||
<br> | ||
<a href="https://nuxt.com/docs"><img src="./.github/assets/documentation.png"></a> | ||
</td> | ||
<td valign="top"> | ||
<h3>Documentation</h3> | ||
<p> | ||
We highly recommend you take a look at <a href="https://nuxt.com">the Nuxt documentation</a> to level up. | ||
</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td width="80" align="center" valign="top"> | ||
<br> | ||
<a href="https://nuxt.com/modules"><img src="./.github/assets/modules.png"></a> | ||
</td> | ||
<td valign="top"> | ||
<h3>Modules</h3> | ||
<p> | ||
Discover our <a href="https://nuxt.com/modules">list of modules</a> to supercharge your Nuxt project. Created by the Nuxt team and community. | ||
</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td width="80" align="center" valign="top"> | ||
<br> | ||
<a href="https://nuxt.com/docs/examples/hello-world"><img src="./.github/assets/examples.png"></a> | ||
</td> | ||
<td> | ||
<h3>Examples</h3> | ||
<p> | ||
Explore different ways of using Nuxt features and get inspired with <a href="https://nuxt.com/docs/examples/essentials/hello-world">our list of examples</a>. | ||
</p> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th width="2000" colspan="2"> | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td width="80" align="center" valign="top"> | ||
<br> | ||
<a href="https://nuxt.com/docs/community/reporting-bugs"><img src="./.github/assets/reporting-bugs.png"></a> | ||
</td> | ||
<td valign="top"> | ||
<h3>Reporting bugs</h3> | ||
<p> | ||
Check out the <a href="https://nuxt.com/docs/community/reporting-bugs">Reporting Bugs</a> page.</p> | ||
</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td width="80" align="center" valign="top"> | ||
<br> | ||
<a href="https://nuxt.com/docs/community/contribution"><img src="./.github/assets/suggestions.png"></a> | ||
</td> | ||
<td valign="top"> | ||
<h3>Suggestions</h3> | ||
<p> | ||
Check out the <a href="https://nuxt.com/docs/community/contribution">Contribution</a> page. | ||
</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td width="80" align="center" valign="top"> | ||
<br> | ||
<a href="https://nuxt.com/docs/community/getting-help"><img src="./.github/assets/questions.png"></a> | ||
</td> | ||
<td valign="top"> | ||
<h3>Questions</h3> | ||
<p> | ||
Check out the <a href="https://nuxt.com/docs/community/getting-help">Getting Help</a> page. | ||
</p> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
## Local Development | ||
Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/docs/community/framework-contribution#set-up-your-local-development-environment) to contribute to the framework and documentation. | ||
## Nuxt 2 | ||
You can find the code for Nuxt 2 on the [`2.x-dev` branch](https://github.com/nuxt/nuxt/tree/2.x-dev) and the documentation at [nuxtjs.org](https://nuxtjs.org). | ||
## Follow us | ||
<p valign="center"> | ||
<a href="https://chat.nuxt.dev"><img width="20px" src="./.github/assets/discord.svg" alt="Discord"></a> <a href="https://twitter.nuxt.dev"><img width="20px" src="./.github/assets/twitter.svg" alt="Twitter"></a> <a href="https://github.nuxt.dev"><img width="20px" src="./.github/assets/github.svg" alt="GitHub"></a> | ||
</p> | ||
## License | ||
[MIT](./LICENSE) | ||
@@ -20,1249 +20,1395 @@ import type { ComponentsOptions } from '../src/types/components' | ||
export interface ConfigSchema { | ||
/** | ||
* Configure Nuxt component auto-registration. | ||
* Any components in the directories configured here can be used throughout your pages, layouts (and other components) without needing to explicitly import them. | ||
/** | ||
* Configure Nuxt component auto-registration. | ||
* | ||
* Any components in the directories configured here can be used throughout your pages, layouts (and other components) without needing to explicitly import them. | ||
* | ||
* | ||
* @see https://nuxt.com/docs/guide/directory-structure/components | ||
*/ | ||
components: boolean | ComponentsOptions | ComponentsOptions['dirs'], | ||
/** | ||
* Configure how Nuxt auto-imports composables into your application. | ||
* | ||
* | ||
* @see [Nuxt 3 documentation](https://nuxt.com/docs/guide/directory-structure/composables) | ||
*/ | ||
imports: ImportsOptions, | ||
/** | ||
* Whether to use the vue-router integration in Nuxt 3. If you do not provide a value it will be enabled if you have a `pages/` directory in your source folder. | ||
* | ||
*/ | ||
pages: boolean, | ||
/** | ||
* Manually disable nuxt telemetry. | ||
* | ||
* | ||
* @see [Nuxt Telemetry](https://github.com/nuxt/telemetry) for more information. | ||
*/ | ||
telemetry: boolean, | ||
/** | ||
* Vue.js config | ||
* | ||
*/ | ||
vue: { | ||
/** | ||
* Options for the Vue compiler that will be passed at build time. | ||
* | ||
* @default {{ dirs: [`~/components`] }} | ||
* | ||
* @see https://v3.nuxtjs.org/guide/directory-structure/components | ||
* @see [documentation](https://vuejs.org/api/application.html#app-config-compileroptions) | ||
*/ | ||
components: boolean | ComponentsOptions | ComponentsOptions['dirs'], | ||
compilerOptions: CompilerOptions, | ||
}, | ||
/** | ||
* Nuxt App configuration. | ||
* | ||
*/ | ||
app: { | ||
/** | ||
* Configure how Nuxt auto-imports composables into your application. | ||
* The base path of your Nuxt application. | ||
* | ||
* @see [Nuxt 3 documentation](https://v3.nuxtjs.org/guide/directory-structure/composables) | ||
* This can be set at runtime by setting the NUXT_APP_BASE_URL environment variable. | ||
* | ||
* @default "/" | ||
* | ||
* @example | ||
* ```bash | ||
* NUXT_APP_BASE_URL=/prefix/ node .output/server/index.mjs | ||
* ``` | ||
*/ | ||
imports: ImportsOptions, | ||
baseURL: string, | ||
/** Whether to use the vue-router integration in Nuxt 3. If you do not provide a value it will be enabled if you have a `pages/` directory in your source folder. */ | ||
pages: boolean, | ||
/** | ||
* The folder name for the built site assets, relative to `baseURL` (or `cdnURL` if set). This is set at build time and should not be customized at runtime. | ||
* | ||
* @default "/_nuxt/" | ||
*/ | ||
buildAssetsDir: string, | ||
/** | ||
* Manually disable nuxt telemetry. | ||
* An absolute URL to serve the public folder from (production-only). | ||
* | ||
* @see [Nuxt Telemetry](https://github.com/nuxt/telemetry) for more information. | ||
* This can be set to a different value at runtime by setting the `NUXT_APP_CDN_URL` environment variable. | ||
* | ||
* @default "" | ||
* | ||
* @example | ||
* ```bash | ||
* NUXT_APP_CDN_URL=https://mycdn.org/ node .output/server/index.mjs | ||
* ``` | ||
*/ | ||
telemetry: boolean, | ||
cdnURL: string, | ||
/** Vue.js config */ | ||
vue: { | ||
/** | ||
* Options for the Vue compiler that will be passed at build time. | ||
* | ||
* @see [documentation](https://vuejs.org/api/application.html#app-config-compileroptions) | ||
*/ | ||
compilerOptions: CompilerOptions, | ||
}, | ||
/** | ||
* Set default configuration for `<head>` on every page. | ||
* | ||
* | ||
* @example | ||
* ```js | ||
* app: { | ||
* head: { | ||
* meta: [ | ||
* // <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
* { name: 'viewport', content: 'width=device-width, initial-scale=1' } | ||
* ], | ||
* script: [ | ||
* // <script src="https://myawesome-lib.js"></script> | ||
* { src: 'https://awesome-lib.js' } | ||
* ], | ||
* link: [ | ||
* // <link rel="stylesheet" href="https://myawesome-lib.css"> | ||
* { rel: 'stylesheet', href: 'https://awesome-lib.css' } | ||
* ], | ||
* // please note that this is an area that is likely to change | ||
* style: [ | ||
* // <style type="text/css">:root { color: red }</style> | ||
* { children: ':root { color: red }', type: 'text/css' } | ||
* ], | ||
* noscript: [ | ||
* // <noscript>JavaScript is required</noscript> | ||
* { children: 'JavaScript is required' } | ||
* ] | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
head: NuxtAppConfig['head'], | ||
/** Nuxt App configuration. */ | ||
app: { | ||
/** | ||
* The base path of your Nuxt application. | ||
* This can be set at runtime by setting the NUXT_APP_BASE_URL environment variable. | ||
* @default "/" | ||
* | ||
* @example | ||
* ```bash | ||
* NUXT_APP_BASE_URL=/prefix/ node .output/server/index.mjs | ||
* ``` | ||
*/ | ||
baseURL: string, | ||
/** | ||
* Default values for layout transitions. | ||
* | ||
* This can be overridden with `definePageMeta` on an individual page. Only JSON-serializable values are allowed. | ||
* | ||
* @default false | ||
* | ||
* @see https://vuejs.org/api/built-in-components.html#transition | ||
*/ | ||
layoutTransition: NuxtAppConfig['layoutTransition'], | ||
/** | ||
* The folder name for the built site assets, relative to `baseURL` (or `cdnURL` if set). This is set at build time and should not be customized at runtime. | ||
* @default "/_nuxt/" | ||
*/ | ||
buildAssetsDir: string, | ||
/** | ||
* Default values for page transitions. | ||
* | ||
* This can be overridden with `definePageMeta` on an individual page. Only JSON-serializable values are allowed. | ||
* | ||
* @default false | ||
* | ||
* @see https://vuejs.org/api/built-in-components.html#transition | ||
*/ | ||
pageTransition: NuxtAppConfig['pageTransition'], | ||
/** | ||
* An absolute URL to serve the public folder from (production-only). | ||
* This can be set to a different value at runtime by setting the `NUXT_APP_CDN_URL` environment variable. | ||
* @default "" | ||
* | ||
* @example | ||
* ```bash | ||
* NUXT_APP_CDN_URL=https://mycdn.org/ node .output/server/index.mjs | ||
* ``` | ||
*/ | ||
cdnURL: string, | ||
/** | ||
* Default values for KeepAlive configuration between pages. | ||
* | ||
* This can be overridden with `definePageMeta` on an individual page. Only JSON-serializable values are allowed. | ||
* | ||
* @default false | ||
* | ||
* @see https://vuejs.org/api/built-in-components.html#keepalive | ||
*/ | ||
keepalive: NuxtAppConfig['keepalive'], | ||
/** | ||
* Set default configuration for `<head>` on every page. | ||
* | ||
* @example | ||
* ```js | ||
* app: { | ||
* head: { | ||
* meta: [ | ||
* // <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
* { name: 'viewport', content: 'width=device-width, initial-scale=1' } | ||
* ], | ||
* script: [ | ||
* // <script src="https://myawesome-lib.js"></script> | ||
* { src: 'https://awesome-lib.js' } | ||
* ], | ||
* link: [ | ||
* // <link rel="stylesheet" href="https://myawesome-lib.css"> | ||
* { rel: 'stylesheet', href: 'https://awesome-lib.css' } | ||
* ], | ||
* // please note that this is an area that is likely to change | ||
* style: [ | ||
* // <style type="text/css">:root { color: red }</style> | ||
* { children: ':root { color: red }', type: 'text/css' } | ||
* ], | ||
* noscript: [ | ||
* // <noscript>Javascript is required</noscript> | ||
* { children: 'Javascript is required' } | ||
* ] | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
head: NuxtAppConfig['head'], | ||
/** | ||
* Customize Nuxt root element id. | ||
* | ||
* @default "__nuxt" | ||
*/ | ||
rootId: string, | ||
/** | ||
* Default values for layout transitions. | ||
* This can be overridden with `definePageMeta` on an individual page. Only JSON-serializable values are allowed. | ||
* @default false | ||
* | ||
* @see https://vuejs.org/api/built-in-components.html#transition | ||
*/ | ||
layoutTransition: NuxtAppConfig['layoutTransition'], | ||
/** | ||
* Customize Nuxt root element tag. | ||
* | ||
* @default "div" | ||
*/ | ||
rootTag: string, | ||
}, | ||
/** | ||
* Default values for page transitions. | ||
* This can be overridden with `definePageMeta` on an individual page. Only JSON-serializable values are allowed. | ||
* @default false | ||
* | ||
* @see https://vuejs.org/api/built-in-components.html#transition | ||
*/ | ||
pageTransition: NuxtAppConfig['pageTransition'], | ||
/** | ||
* An array of nuxt app plugins. | ||
* | ||
* Each plugin can be a string (which can be an absolute or relative path to a file). If it ends with `.client` or `.server` then it will be automatically loaded only in the appropriate context. | ||
* It can also be an object with `src` and `mode` keys. | ||
* | ||
* | ||
* @note Plugins are also auto-registered from the `~/plugins` directory | ||
* and these plugins do not need to be listed in `nuxt.config` unless you | ||
* need to customize their order. All plugins are deduplicated by their src path. | ||
* | ||
* @see https://nuxt.com/docs/guide/directory-structure/plugins | ||
* | ||
* @example | ||
* ```js | ||
* plugins: [ | ||
* '~/plugins/foo.client.js', // only in client side | ||
* '~/plugins/bar.server.js', // only in server side | ||
* '~/plugins/baz.js', // both client & server | ||
* { src: '~/plugins/both-sides.js' }, | ||
* { src: '~/plugins/client-only.js', mode: 'client' }, // only on client side | ||
* { src: '~/plugins/server-only.js', mode: 'server' } // only on server side | ||
* ] | ||
* ``` | ||
*/ | ||
plugins: (NuxtPlugin | string)[], | ||
/** | ||
* Default values for KeepAlive configuration between pages. | ||
* This can be overridden with `definePageMeta` on an individual page. Only JSON-serializable values are allowed. | ||
* @default false | ||
* | ||
* @see https://vuejs.org/api/built-in-components.html#keepalive | ||
*/ | ||
keepalive: NuxtAppConfig['keepalive'], | ||
/** | ||
* You can define the CSS files/modules/libraries you want to set globally (included in every page). | ||
* | ||
* Nuxt will automatically guess the file type by its extension and use the appropriate pre-processor. You will still need to install the required loader if you need to use them. | ||
* | ||
* | ||
* @example | ||
* ```js | ||
* css: [ | ||
* // Load a Node.js module directly (here it's a Sass file). | ||
* 'bulma', | ||
* // CSS file in the project | ||
* '@/assets/css/main.css', | ||
* // SCSS file in the project | ||
* '@/assets/css/main.scss' | ||
* ] | ||
* ``` | ||
*/ | ||
css: string[], | ||
/** | ||
* Customize Nuxt root element id. | ||
* @default "__nuxt" | ||
*/ | ||
rootId: string, | ||
/** | ||
* The builder to use for bundling the Vue part of your application. | ||
* | ||
* @default "@nuxt/vite-builder" | ||
*/ | ||
builder: 'vite' | 'webpack' | { bundle: (nuxt: Nuxt) => Promise<void> }, | ||
/** | ||
* Customize Nuxt root element tag. | ||
* @default "div" | ||
*/ | ||
rootTag: string, | ||
}, | ||
/** | ||
* Whether to generate sourcemaps. | ||
* | ||
*/ | ||
sourcemap: boolean | { server?: boolean, client?: boolean }, | ||
/** | ||
* Shared build configuration. | ||
* | ||
*/ | ||
build: { | ||
/** | ||
* An array of nuxt app plugins. | ||
* Each plugin can be a string (which can be an absolute or relative path to a file). If it ends with `.client` or `.server` then it will be automatically loaded only in the appropriate context. | ||
* It can also be an object with `src` and `mode` keys. | ||
* If you want to transpile specific dependencies with Babel, you can add them here. Each item in transpile can be a package name, a function, a string or regex object matching the dependency's file name. | ||
* | ||
* You can also use a function to conditionally transpile. The function will receive an object ({ isDev, isServer, isClient, isModern, isLegacy }). | ||
* | ||
* | ||
* @example | ||
* ```js | ||
* plugins: [ | ||
* '~/plugins/foo.client.js', // only in client side | ||
* '~/plugins/bar.server.js', // only in server side | ||
* '~/plugins/baz.js', // both client & server | ||
* { src: '~/plugins/both-sides.js' }, | ||
* { src: '~/plugins/client-only.js', mode: 'client' }, // only on client side | ||
* { src: '~/plugins/server-only.js', mode: 'server' } // only on server side | ||
* ] | ||
* transpile: [({ isLegacy }) => isLegacy && 'ky'] | ||
* ``` | ||
*/ | ||
plugins: (NuxtPlugin | string)[], | ||
transpile: Array<string | RegExp | ((ctx: { isClient?: boolean; isServer?: boolean; isDev: boolean }) => string | RegExp | false)>, | ||
/** | ||
* You can define the CSS files/modules/libraries you want to set globally (included in every page). | ||
* Nuxt will automatically guess the file type by its extension and use the appropriate pre-processor. You will still need to install the required loader if you need to use them. | ||
* You can provide your own templates which will be rendered based on Nuxt configuration. This feature is specially useful for using with modules. | ||
* | ||
* Templates are rendered using [`lodash.template`](https://lodash.com/docs/4.17.15#template). | ||
* | ||
* | ||
* @example | ||
* ```js | ||
* css: [ | ||
* // Load a Node.js module directly (here it's a Sass file). | ||
* 'bulma', | ||
* // CSS file in the project | ||
* '@/assets/css/main.css', | ||
* // SCSS file in the project | ||
* '@/assets/css/main.scss' | ||
* templates: [ | ||
* { | ||
* src: '~/modules/support/plugin.js', // `src` can be absolute or relative | ||
* dst: 'support.js', // `dst` is relative to project `.nuxt` dir | ||
* options: { | ||
* // Options are provided to template as `options` key | ||
* live_chat: false | ||
* } | ||
* } | ||
* ] | ||
* ``` | ||
*/ | ||
css: string[], | ||
templates: Array<any>, | ||
/** | ||
* The builder to use for bundling the Vue part of your application. | ||
* @default "@nuxt/vite-builder" | ||
* Nuxt uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them. | ||
* | ||
* Set to `true` to enable bundle analysis, or pass an object with options: [for webpack](https://github.com/webpack-contrib/webpack-bundle-analyzer#options-for-plugin) or [for vite](https://github.com/btd/rollup-plugin-visualizer#options). | ||
* | ||
* @default false | ||
* | ||
* @example | ||
* ```js | ||
* analyze: { | ||
* analyzerMode: 'static' | ||
* } | ||
* ``` | ||
*/ | ||
builder: 'vite' | 'webpack' | { bundle: (nuxt: Nuxt) => Promise<void> }, | ||
analyze: boolean | BundleAnalyzerPlugin.Options | PluginVisualizerOptions, | ||
}, | ||
/** Whether to generate sourcemaps. */ | ||
sourcemap: boolean | { server?: boolean, client?: boolean }, | ||
/** | ||
* 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 use `github:`, `gitlab:`, `bitbucket:` or `https://` to extend from a remote git repository. | ||
* | ||
*/ | ||
extends: string|string[], | ||
/** Shared build configuration. */ | ||
build: { | ||
/** | ||
* If you want to transpile specific dependencies with Babel, you can add them here. Each item in transpile can be a package name, a function, a string or regex object matching the dependency's file name. | ||
* You can also use a function to conditionally transpile. The function will receive an object ({ isDev, isServer, isClient, isModern, isLegacy }). | ||
* | ||
* @example | ||
* ```js | ||
* transpile: [({ isLegacy }) => isLegacy && 'ky'] | ||
* ``` | ||
*/ | ||
transpile: Array<string | RegExp | Function>, | ||
/** | ||
* Extend project from a local or remote source. | ||
* | ||
* Value should be a string pointing to source directory or config path relative to current config. | ||
* You can use `github:`, `gitlab:`, `bitbucket:` or `https://` to extend from a remote git repository. | ||
* | ||
* @default null | ||
*/ | ||
theme: string, | ||
/** | ||
* You can provide your own templates which will be rendered based on Nuxt configuration. This feature is specially useful for using with modules. | ||
* Templates are rendered using [`lodash.template`](https://lodash.com/docs/4.17.15#template). | ||
* | ||
* @example | ||
* ```js | ||
* templates: [ | ||
* { | ||
* src: '~/modules/support/plugin.js', // `src` can be absolute or relative | ||
* dst: 'support.js', // `dst` is relative to project `.nuxt` dir | ||
* options: { | ||
* // Options are provided to template as `options` key | ||
* live_chat: false | ||
* } | ||
* } | ||
* ] | ||
* ``` | ||
*/ | ||
templates: Array<any>, | ||
/** | ||
* Define the root directory of your application. | ||
* | ||
* This property can be overwritten (for example, running `nuxt ./my-app/` will set the `rootDir` to the absolute path of `./my-app/` from the current/working directory. | ||
* It is normally not needed to configure this option. | ||
* | ||
* @default "/<rootDir>" | ||
*/ | ||
rootDir: string, | ||
/** | ||
* Nuxt uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them. | ||
* Set to `true` to enable bundle analysis, or pass an object with options: [for webpack](https://github.com/webpack-contrib/webpack-bundle-analyzer#options-for-plugin) or [for vite](https://github.com/btd/rollup-plugin-visualizer#options). | ||
* @default false | ||
* | ||
* @example | ||
* ```js | ||
* analyze: { | ||
* analyzerMode: 'static' | ||
* } | ||
* ``` | ||
*/ | ||
analyze: boolean | BundleAnalyzerPlugin.Options | PluginVisualizerOptions, | ||
}, | ||
/** | ||
* Define the workspace directory of your application. | ||
* | ||
* Often this is used when in a monorepo setup. Nuxt will attempt to detect your workspace directory automatically, but you can override it here. | ||
* It is normally not needed to configure this option. | ||
* | ||
* @default "/<rootDir>" | ||
*/ | ||
workspaceDir: string, | ||
/** | ||
* Define the source directory of your Nuxt application. | ||
* | ||
* If a relative path is specified, it will be relative to the `rootDir`. | ||
* | ||
* @default "/<rootDir>" | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* srcDir: 'src/' | ||
* } | ||
* ``` | ||
* This would work with the following folder structure: | ||
* ```bash | ||
* -| app/ | ||
* ---| node_modules/ | ||
* ---| nuxt.config.js | ||
* ---| package.json | ||
* ---| src/ | ||
* ------| assets/ | ||
* ------| components/ | ||
* ------| layouts/ | ||
* ------| middleware/ | ||
* ------| pages/ | ||
* ------| plugins/ | ||
* ------| static/ | ||
* ------| store/ | ||
* ------| server/ | ||
* ``` | ||
*/ | ||
srcDir: string, | ||
/** | ||
* Define the server directory of your Nuxt application, where Nitro routes, middleware and plugins are kept. | ||
* | ||
* If a relative path is specified, it will be relative to your `rootDir`. | ||
* | ||
* @default "/<rootDir>/server" | ||
*/ | ||
serverDir: string, | ||
/** | ||
* Define the directory where your built Nuxt files will be placed. | ||
* | ||
* Many tools assume that `.nuxt` is a hidden directory (because it starts with a `.`). If that is a problem, you can use this option to prevent that. | ||
* | ||
* @default "/<rootDir>/.nuxt" | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* buildDir: 'nuxt-build' | ||
* } | ||
* ``` | ||
*/ | ||
buildDir: string, | ||
/** | ||
* Used to set the modules directories for path resolving (for example, webpack's `resolveLoading`, `nodeExternals` and `postcss`). | ||
* | ||
* The configuration path is relative to `options.rootDir` (default is current working directory). | ||
* Setting this field may be necessary if your project is organized as a yarn workspace-styled mono-repository. | ||
* | ||
* @default ["/<rootDir>/node_modules","/Users/daniel/code/nuxt.js/packages/schema/node_modules"] | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* modulesDir: ['../../node_modules'] | ||
* } | ||
* ``` | ||
*/ | ||
modulesDir: Array<string>, | ||
/** | ||
* Whether Nuxt is running in development mode. | ||
* | ||
* Normally, you should not need to set this. | ||
* | ||
* @default false | ||
*/ | ||
dev: boolean, | ||
/** | ||
* Whether your app is being unit tested. | ||
* | ||
* @default false | ||
*/ | ||
test: boolean, | ||
/** | ||
* Set to `true` to enable debug mode. | ||
* | ||
* At the moment, it prints out hook names and timings on the server, and logs hook arguments as well in the browser. | ||
* | ||
* @default false | ||
*/ | ||
debug: boolean, | ||
/** | ||
* Whether to enable rendering of HTML - either dynamically (in server mode) or at generate time. If set to `false` and combined with `static` target, generated pages will simply display a loading screen with no content. | ||
* | ||
* @default true | ||
*/ | ||
ssr: boolean, | ||
/** | ||
* Modules are Nuxt extensions which can extend its core functionality and add endless integrations. | ||
* | ||
* Each module is either a string (which can refer to a package, or be a path to a file), a tuple with the module as first string and the options as a second object, or an inline module function. | ||
* Nuxt tries to resolve each item in the modules array using node require path (in `node_modules`) and then will be resolved from project `srcDir` if `~` alias is used. | ||
* | ||
* | ||
* @note Modules are executed sequentially so the order is important. | ||
* | ||
* @example | ||
* ```js | ||
* modules: [ | ||
* // Using package name | ||
* '@nuxtjs/axios', | ||
* // Relative to your project srcDir | ||
* '~/modules/awesome.js', | ||
* // Providing options | ||
* ['@nuxtjs/google-analytics', { ua: 'X1234567' }], | ||
* // Inline definition | ||
* function () {} | ||
* ] | ||
* ``` | ||
*/ | ||
modules: (NuxtModule | string | [NuxtModule | string, Record<string, any>])[], | ||
/** | ||
* Customize default directory structure used by Nuxt. | ||
* | ||
* It is better to stick with defaults unless needed. | ||
* | ||
*/ | ||
dir: { | ||
/** | ||
* 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 use `github:`, `gitlab:`, `bitbucket:` or `https://` to extend from a remote git repository. | ||
* The assets directory (aliased as `~assets` in your build). | ||
* | ||
* @default "assets" | ||
*/ | ||
extends: string|string[], | ||
assets: string, | ||
/** | ||
* Extend project from a local or remote source. | ||
* Value should be a string pointing to source directory or config path relative to current config. | ||
* You can use `github:`, `gitlab:`, `bitbucket:` or `https://` to extend from a remote git repository. | ||
* @default null | ||
* The layouts directory, each file of which will be auto-registered as a Nuxt layout. | ||
* | ||
* @default "layouts" | ||
*/ | ||
theme: string, | ||
layouts: string, | ||
/** | ||
* Define the root directory of your application. | ||
* This property can be overwritten (for example, running `nuxt ./my-app/` will set the `rootDir` to the absolute path of `./my-app/` from the current/working directory. | ||
* It is normally not needed to configure this option. | ||
* @default "/<rootDir>" | ||
* The middleware directory, each file of which will be auto-registered as a Nuxt middleware. | ||
* | ||
* @default "middleware" | ||
*/ | ||
rootDir: string, | ||
middleware: string, | ||
/** | ||
* Define the workspace directory of your application. | ||
* Often this is used when in a monorepo setup. Nuxt will attempt to detect your workspace directory automatically, but you can override it here. | ||
* It is normally not needed to configure this option. | ||
* @default "/<rootDir>" | ||
* The directory which will be processed to auto-generate your application page routes. | ||
* | ||
* @default "pages" | ||
*/ | ||
workspaceDir: string, | ||
pages: string, | ||
/** | ||
* Define the source directory of your Nuxt application. | ||
* If a relative path is specified, it will be relative to the `rootDir`. | ||
* @default "/<rootDir>" | ||
* The plugins directory, each file of which will be auto-registered as a Nuxt plugin. | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* srcDir: 'src/' | ||
* } | ||
* ``` | ||
* This would work with the following folder structure: | ||
* ```bash | ||
* -| app/ | ||
* ---| node_modules/ | ||
* ---| nuxt.config.js | ||
* ---| package.json | ||
* ---| src/ | ||
* ------| assets/ | ||
* ------| components/ | ||
* ------| layouts/ | ||
* ------| middleware/ | ||
* ------| pages/ | ||
* ------| plugins/ | ||
* ------| static/ | ||
* ------| store/ | ||
* ------| server/ | ||
* ``` | ||
* @default "plugins" | ||
*/ | ||
srcDir: string, | ||
plugins: string, | ||
/** | ||
* Define the server directory of your Nuxt application, where Nitro routes, middleware and plugins are kept. | ||
* If a relative path is specified, it will be relative to your `rootDir`. | ||
* @default "/<rootDir>/server" | ||
* The directory containing your static files, which will be directly accessible via the Nuxt server and copied across into your `dist` folder when your app is generated. | ||
* | ||
* @default "public" | ||
*/ | ||
serverDir: string, | ||
public: string, | ||
/** | ||
* Define the directory where your built Nuxt files will be placed. | ||
* Many tools assume that `.nuxt` is a hidden directory (because it starts with a `.`). If that is a problem, you can use this option to prevent that. | ||
* @default "/<rootDir>/.nuxt" | ||
* @default "public" | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* buildDir: 'nuxt-build' | ||
* } | ||
* ``` | ||
* @deprecated use `dir.public` option instead | ||
*/ | ||
buildDir: string, | ||
static: string, | ||
}, | ||
/** | ||
* The extensions that should be resolved by the Nuxt resolver. | ||
* | ||
* @default [".js",".jsx",".mjs",".ts",".tsx",".vue"] | ||
*/ | ||
extensions: Array<string>, | ||
/** | ||
* You can improve your DX by defining additional aliases to access custom directories within your JavaScript and CSS. | ||
* | ||
* | ||
* @note Within a webpack context (image sources, CSS - but not JavaScript) you _must_ access | ||
* your alias by prefixing it with `~`. | ||
* | ||
* @note These aliases will be automatically added to the generated `.nuxt/tsconfig.json` so you can get full | ||
* type support and path auto-complete. In case you need to extend options provided by `./.nuxt/tsconfig.json` | ||
* further, make sure to add them here or within the `typescript.tsConfig` property in `nuxt.config`. | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* alias: { | ||
* 'images': fileURLToPath(new URL('./assets/images', import.meta.url)), | ||
* 'style': fileURLToPath(new URL('./assets/style', import.meta.url)), | ||
* 'data': fileURLToPath(new URL('./assets/other/data', import.meta.url)) | ||
* } | ||
* } | ||
* ``` | ||
* | ||
* ```html | ||
* <template> | ||
* <img src="~images/main-bg.jpg"> | ||
* </template> | ||
* | ||
* <script> | ||
* import data from 'data/test.json' | ||
* </script> | ||
* | ||
* <style> | ||
* // Uncomment the below | ||
* //@import '~style/variables.scss'; | ||
* //@import '~style/utils.scss'; | ||
* //@import '~style/base.scss'; | ||
* body { | ||
* background-image: url('~images/main-bg.jpg'); | ||
* } | ||
* </style> | ||
* ``` | ||
*/ | ||
alias: Record<string, string>, | ||
/** | ||
* Pass options directly to `node-ignore` (which is used by Nuxt to ignore files). | ||
* | ||
* | ||
* @see [node-ignore](https://github.com/kaelzhang/node-ignore) | ||
* | ||
* @example | ||
* ```js | ||
* ignoreOptions: { | ||
* ignorecase: false | ||
* } | ||
* ``` | ||
*/ | ||
ignoreOptions: any, | ||
/** | ||
* Any file in `pages/`, `layouts/`, `middleware/` or `store/` will be ignored during building if its filename starts with the prefix specified by `ignorePrefix`. | ||
* | ||
* @default "-" | ||
*/ | ||
ignorePrefix: string, | ||
/** | ||
* More customizable than `ignorePrefix`: all files matching glob patterns specified inside the `ignore` array will be ignored in building. | ||
* | ||
* @default ["**\/*.stories.{js,ts,jsx,tsx}","**\/*.{spec,test}.{js,ts,jsx,tsx}","**\/*.d.ts",".output","**\/-*.*"] | ||
*/ | ||
ignore: Array<string>, | ||
/** | ||
* The watchers property lets you overwrite watchers configuration in your `nuxt.config`. | ||
* | ||
*/ | ||
watchers: { | ||
/** | ||
* Used to set the modules directories for path resolving (for example, webpack's `resolveLoading`, `nodeExternals` and `postcss`). | ||
* The configuration path is relative to `options.rootDir` (default is current working directory). | ||
* Setting this field may be necessary if your project is organized as a yarn workspace-styled mono-repository. | ||
* @default ["/<rootDir>/node_modules","/Users/pooya/Code/framework/packages/schema/node_modules"] | ||
* An array of event types, which, when received, will cause the watcher to restart. | ||
* | ||
*/ | ||
rewatchOnRawEvents: any, | ||
/** | ||
* `watchOptions` to pass directly to webpack. | ||
* | ||
* | ||
* @see [webpack@4 watch options](https://v4.webpack.js.org/configuration/watch/#watchoptions). | ||
*/ | ||
webpack: { | ||
/** @default 1000 */ | ||
aggregateTimeout: number, | ||
}, | ||
/** | ||
* Options to pass directly to `chokidar`. | ||
* | ||
* | ||
* @see [chokidar](https://github.com/paulmillr/chokidar#api) | ||
*/ | ||
chokidar: { | ||
/** @default true */ | ||
ignoreInitial: boolean, | ||
}, | ||
}, | ||
/** | ||
* Hooks are listeners to Nuxt events that are typically used in modules, but are also available in `nuxt.config`. | ||
* | ||
* Internally, hooks follow a naming pattern using colons (e.g., build:done). | ||
* For ease of configuration, you can also structure them as an hierarchical object in `nuxt.config` (as below). | ||
* | ||
* | ||
* @example | ||
* ```js'node:fs' | ||
* import fs from 'node:fs' | ||
* import path from 'node:path' | ||
* export default { | ||
* hooks: { | ||
* build: { | ||
* done(builder) { | ||
* const extraFilePath = path.join( | ||
* builder.nuxt.options.buildDir, | ||
* 'extra-file' | ||
* ) | ||
* fs.writeFileSync(extraFilePath, 'Something extra') | ||
* } | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
hooks: NuxtHooks, | ||
/** | ||
* Runtime config allows passing dynamic config and environment variables to the Nuxt app context. | ||
* | ||
* The value of this object is accessible from server only using `useRuntimeConfig`. | ||
* It mainly should hold _private_ configuration which is not exposed on the frontend. This could include a reference to your API secret tokens. | ||
* Anything under `public` and `app` will be exposed to the frontend as well. | ||
* Values are automatically replaced by matching env variables at runtime, e.g. setting an environment variable `NUXT_API_KEY=my-api-key NUXT_PUBLIC_BASE_URL=/foo/` would overwrite the two values in the example below. | ||
* | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* runtimeConfig: { | ||
* apiKey: '' // Default to an empty string, automatically set at runtime using process.env.NUXT_API_KEY | ||
* public: { | ||
* baseURL: '' // Exposed to the frontend as well. | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
runtimeConfig: RuntimeConfig, | ||
/** | ||
* Additional app configuration | ||
* | ||
* For programmatic usage and type support, you can directly provide app config with this option. It will be merged with `app.config` file as default value. | ||
* | ||
*/ | ||
appConfig: AppConfig, | ||
devServer: { | ||
/** | ||
* Whether to enable HTTPS. | ||
* | ||
* @default false | ||
* | ||
* @example | ||
* ```js | ||
* ``` | ||
* import { fileURLToPath } from 'node:url' | ||
* export default { | ||
* modulesDir: ['../../node_modules'] | ||
* server: { | ||
* https: { | ||
* key: fs.readFileSync(fileURLToPath(new URL('./server.key', import.meta.url))), | ||
* cert: fs.readFileSync(fileURLToPath(new URL('./server.crt', import.meta.url))) | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
modulesDir: Array<string>, | ||
https: false | { key: string; cert: string }, | ||
/** | ||
* Whether Nuxt is running in development mode. | ||
* Normally, you should not need to set this. | ||
* @default false | ||
* Dev server listening port | ||
* | ||
* @default 3000 | ||
*/ | ||
dev: boolean, | ||
port: number, | ||
/** | ||
* Whether your app is being unit tested. | ||
* @default false | ||
* Dev server listening host | ||
* | ||
* @default "localhost" | ||
*/ | ||
test: boolean, | ||
host: string, | ||
/** | ||
* Set to `true` to enable debug mode. | ||
* At the moment, it prints out hook names and timings on the server, and logs hook arguments as well in the browser. | ||
* @default false | ||
* Listening dev server url | ||
* | ||
* @default "http://localhost:3000" | ||
*/ | ||
debug: boolean, | ||
url: string, | ||
}, | ||
experimental: { | ||
/** | ||
* Whether to enable rendering of HTML - either dynamically (in server mode) or at generate time. If set to `false` and combined with `static` target, generated pages will simply display a loading screen with no content. | ||
* @default true | ||
* Set to true to generate an async entry point for the Vue bundle (for module federation support). | ||
* | ||
* @default false | ||
*/ | ||
ssr: boolean, | ||
asyncEntry: boolean, | ||
/** | ||
* Modules are Nuxt extensions which can extend its core functionality and add endless integrations. | ||
* Each module is either a string (which can refer to a package, or be a path to a file), a tuple with the module as first string and the options as a second object, or an inline module function. | ||
* Nuxt tries to resolve each item in the modules array using node require path (in `node_modules`) and then will be resolved from project `srcDir` if `~` alias is used. | ||
* Enable Vue's reactivity transform | ||
* | ||
* @note Modules are executed sequentially so the order is important. | ||
* @default false | ||
* | ||
* @example | ||
* ```js | ||
* modules: [ | ||
* // Using package name | ||
* '@nuxtjs/axios', | ||
* // Relative to your project srcDir | ||
* '~/modules/awesome.js', | ||
* // Providing options | ||
* ['@nuxtjs/google-analytics', { ua: 'X1234567' }], | ||
* // Inline definition | ||
* function () {} | ||
* ] | ||
* ``` | ||
* @see https://vuejs.org/guide/extras/reactivity-transform.html | ||
*/ | ||
modules: (NuxtModule | string | [NuxtModule | string, Record<string, any>])[], | ||
reactivityTransform: boolean, | ||
/** | ||
* Customize default directory structure used by Nuxt. | ||
* It is better to stick with defaults unless needed. | ||
* Externalize `vue`, `@vue/*` and `vue-router` when building. | ||
* | ||
* @default true | ||
* | ||
* @see https://github.com/nuxt/nuxt/issues/13632 | ||
*/ | ||
dir: { | ||
/** | ||
* The assets directory (aliased as `~assets` in your build). | ||
* @default "assets" | ||
*/ | ||
assets: string, | ||
externalVue: boolean, | ||
/** | ||
* The layouts directory, each file of which will be auto-registered as a Nuxt layout. | ||
* @default "layouts" | ||
*/ | ||
layouts: string, | ||
/** | ||
* The middleware directory, each file of which will be auto-registered as a Nuxt middleware. | ||
* @default "middleware" | ||
*/ | ||
middleware: string, | ||
/** | ||
* The directory which will be processed to auto-generate your application page routes. | ||
* @default "pages" | ||
*/ | ||
pages: string, | ||
/** | ||
* The plugins directory, each file of which will be auto-registered as a Nuxt plugin. | ||
* @default "plugins" | ||
*/ | ||
plugins: string, | ||
/** | ||
* The directory containing your static files, which will be directly accessible via the Nuxt server and copied across into your `dist` folder when your app is generated. | ||
* @default "public" | ||
*/ | ||
public: string, | ||
/** | ||
* @default "public" | ||
* | ||
* @deprecated use `dir.public` option instead | ||
*/ | ||
static: string, | ||
}, | ||
/** | ||
* The extensions that should be resolved by the Nuxt resolver. | ||
* @default [".js",".jsx",".mjs",".ts",".tsx",".vue"] | ||
* Tree shakes contents of client-only components from server bundle. | ||
* | ||
* @default true | ||
* | ||
* @see https://github.com/nuxt/framework/pull/5750 | ||
*/ | ||
extensions: Array<string>, | ||
treeshakeClientOnly: boolean, | ||
/** | ||
* You can improve your DX by defining additional aliases to access custom directories within your JavaScript and CSS. | ||
* Use vite-node for on-demand server chunk loading | ||
* | ||
* @note Within a webpack context (image sources, CSS - but not JavaScript) you _must_ access | ||
* your alias by prefixing it with `~`. | ||
* @default true | ||
* | ||
* @note These aliases will be automatically added to the generated `.nuxt/tsconfig.json` so you can get full | ||
* type support and path auto-complete. In case you need to extend options provided by `./.nuxt/tsconfig.json` | ||
* further, make sure to add them here or within the `typescript.tsConfig` property in `nuxt.config`. | ||
* @deprecated use `vite.devBundler: 'vite-node'` | ||
*/ | ||
viteNode: boolean, | ||
/** | ||
* Split server bundle into multiple chunks and dynamically import them. | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* alias: { | ||
* 'images': fileURLToPath(new URL('./assets/images', import.meta.url)), | ||
* 'style': fileURLToPath(new URL('./assets/style', import.meta.url)), | ||
* 'data': fileURLToPath(new URL('./assets/other/data', import.meta.url)) | ||
* } | ||
* } | ||
* ``` | ||
* @default true | ||
* | ||
* ```html | ||
* <template> | ||
* <img src="~images/main-bg.jpg"> | ||
* </template> | ||
* @see https://github.com/nuxt/nuxt/issues/14525 | ||
*/ | ||
viteServerDynamicImports: boolean, | ||
/** | ||
* Inline styles when rendering HTML (currently vite only). | ||
* | ||
* <script> | ||
* import data from 'data/test.json' | ||
* </script> | ||
* You can also pass a function that receives the path of a Vue component and returns a boolean indicating whether to inline the styles for that component. | ||
* | ||
* <style> | ||
* // Uncomment the below | ||
* //@import '~style/variables.scss'; | ||
* //@import '~style/utils.scss'; | ||
* //@import '~style/base.scss'; | ||
* body { | ||
* background-image: url('~images/main-bg.jpg'); | ||
* } | ||
* </style> | ||
* ``` | ||
* @default true | ||
*/ | ||
alias: Record<string, string>, | ||
inlineSSRStyles: boolean | ((id?: string) => boolean), | ||
/** | ||
* Pass options directly to `node-ignore` (which is used by Nuxt to ignore files). | ||
* Turn off rendering of Nuxt scripts and JS resource hints. | ||
* | ||
* @see [node-ignore](https://github.com/kaelzhang/node-ignore) | ||
* @default false | ||
*/ | ||
noScripts: boolean, | ||
/** | ||
* When this option is enabled (by default) payload of pages generated with `nuxt generate` are extracted | ||
* | ||
* @example | ||
* ```js | ||
* ignoreOptions: { | ||
* ignorecase: false | ||
* } | ||
* ``` | ||
* @default false | ||
*/ | ||
ignoreOptions: any, | ||
payloadExtraction: boolean, | ||
/** | ||
* Any file in `pages/`, `layouts/`, `middleware/` or `store/` will be ignored during building if its filename starts with the prefix specified by `ignorePrefix`. | ||
* @default "-" | ||
* Enable cross-origin prefetch using the Speculation Rules API. | ||
* | ||
* @default false | ||
*/ | ||
ignorePrefix: string, | ||
crossOriginPrefetch: boolean, | ||
/** | ||
* More customizable than `ignorePrefix`: all files matching glob patterns specified inside the `ignore` array will be ignored in building. | ||
* @default ["**\/*.stories.{js,ts,jsx,tsx}","**\/*.{spec,test}.{js,ts,jsx,tsx}","**\/*.d.ts",".output","**\/-*.*"] | ||
* Write early hints when using node server. | ||
* | ||
* @default false | ||
* | ||
* @note nginx does not support 103 Early hints in the current version. | ||
*/ | ||
ignore: Array<string>, | ||
writeEarlyHints: boolean, | ||
/** The watchers property lets you overwrite watchers configuration in your `nuxt.config`. */ | ||
watchers: { | ||
/** An array of event types, which, when received, will cause the watcher to restart. */ | ||
rewatchOnRawEvents: any, | ||
/** | ||
* Experimental component islands support with <NuxtIsland> and .island.vue files. | ||
* | ||
* @default false | ||
*/ | ||
componentIslands: boolean, | ||
/** | ||
* `watchOptions` to pass directly to webpack. | ||
* | ||
* @see [webpack@4 watch options](https://v4.webpack.js.org/configuration/watch/#watchoptions). | ||
*/ | ||
webpack: { | ||
/** @default 1000 */ | ||
aggregateTimeout: number, | ||
}, | ||
/** | ||
* Options to pass directly to `chokidar`. | ||
* | ||
* @see [chokidar](https://github.com/paulmillr/chokidar#api) | ||
*/ | ||
chokidar: { | ||
/** @default true */ | ||
ignoreInitial: boolean, | ||
}, | ||
}, | ||
/** | ||
* Hooks are listeners to Nuxt events that are typically used in modules, but are also available in `nuxt.config`. | ||
* Internally, hooks follow a naming pattern using colons (e.g., build:done). | ||
* For ease of configuration, you can also structure them as an hierarchical object in `nuxt.config` (as below). | ||
* Enable experimental config schema support | ||
* | ||
* @example | ||
* ```js'node:fs' | ||
* import fs from 'node:fs' | ||
* import path from 'node:path' | ||
* export default { | ||
* hooks: { | ||
* build: { | ||
* done(builder) { | ||
* const extraFilePath = path.join( | ||
* builder.nuxt.options.buildDir, | ||
* 'extra-file' | ||
* ) | ||
* fs.writeFileSync(extraFilePath, 'Something extra') | ||
* } | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
* @default false | ||
* | ||
* @see https://github.com/nuxt/nuxt/issues/15592 | ||
*/ | ||
hooks: NuxtHooks, | ||
configSchema: boolean, | ||
}, | ||
generate: { | ||
/** | ||
* Runtime config allows passing dynamic config and environment variables to the Nuxt app context. | ||
* The value of this object is accessible from server only using `useRuntimeConfig`. | ||
* It mainly should hold _private_ configuration which is not exposed on the frontend. This could include a reference to your API secret tokens. | ||
* Anything under `public` and `app` will be exposed to the frontend as well. | ||
* Values are automatically replaced by matching env variables at runtime, e.g. setting an environment variable `NUXT_API_KEY=my-api-key NUXT_PUBLIC_BASE_URL=/foo/` would overwrite the two values in the example below. | ||
* The routes to generate. | ||
* | ||
* If you are using the crawler, this will be only the starting point for route generation. This is often necessary when using dynamic routes. | ||
* It is preferred to use `nitro.prerender.routes`. | ||
* | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* runtimeConfig: { | ||
* apiKey: '' // Default to an empty string, automatically set at runtime using process.env.NUXT_API_KEY | ||
* public: { | ||
* baseURL: '' // Exposed to the frontend as well. | ||
* } | ||
* } | ||
* } | ||
* routes: ['/users/1', '/users/2', '/users/3'] | ||
* ``` | ||
*/ | ||
runtimeConfig: RuntimeConfig, | ||
routes: Array<any>, | ||
/** | ||
* Additional app configuration | ||
* For programmatic usage and type support, you can directly provide app config with this option. It will be merged with `app.config` file as default value. | ||
* This option is no longer used. Instead, use `nitro.prerender.ignore`. | ||
* | ||
*/ | ||
appConfig: AppConfig, | ||
exclude: Array<any>, | ||
}, | ||
devServer: { | ||
/** | ||
* Whether to enable HTTPS. | ||
* @default false | ||
* | ||
* @example | ||
* ``` | ||
* import { fileURLToPath } from 'node:url' | ||
* export default { | ||
* server: { | ||
* https: { | ||
* key: fs.readFileSync(fileURLToPath(new URL('./server.key', import.meta.url))), | ||
* cert: fs.readFileSync(fileURLToPath(new URL('./server.crt', import.meta.url))) | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
https: false | { key: string; cert: string }, | ||
/** | ||
* @default 3 | ||
* | ||
* @private | ||
*/ | ||
_majorVersion: number, | ||
/** | ||
* Dev server listening port | ||
* @default 3000 | ||
*/ | ||
port: number, | ||
/** | ||
* @default false | ||
* | ||
* @private | ||
*/ | ||
_legacyGenerate: boolean, | ||
/** | ||
* Dev server listening host | ||
* @default "localhost" | ||
*/ | ||
host: string, | ||
/** | ||
* @default false | ||
* | ||
* @private | ||
*/ | ||
_start: boolean, | ||
/** | ||
* Listening dev server url | ||
* @default "http://localhost:3000" | ||
*/ | ||
url: string, | ||
}, | ||
/** | ||
* @default false | ||
* | ||
* @private | ||
*/ | ||
_build: boolean, | ||
experimental: { | ||
/** | ||
* Set to true to generate an async entry point for the Vue bundle (for module federation support). | ||
* @default false | ||
*/ | ||
asyncEntry: boolean, | ||
/** | ||
* @default false | ||
* | ||
* @private | ||
*/ | ||
_generate: boolean, | ||
/** | ||
* Enable Vue's reactivity transform | ||
* @default false | ||
* | ||
* @see https://vuejs.org/guide/extras/reactivity-transform.html | ||
*/ | ||
reactivityTransform: boolean, | ||
/** | ||
* @default false | ||
* | ||
* @private | ||
*/ | ||
_prepare: boolean, | ||
/** | ||
* Externalize `vue`, `@vue/*` and `vue-router` when building. | ||
* @default true | ||
* | ||
* @see https://github.com/nuxt/framework/issues/4084 | ||
*/ | ||
externalVue: boolean, | ||
/** | ||
* @default false | ||
* | ||
* @private | ||
*/ | ||
_cli: boolean, | ||
/** | ||
* Tree shakes contents of client-only components from server bundle. | ||
* @default true | ||
* | ||
* @see https://github.com/nuxt/framework/pull/5750 | ||
*/ | ||
treeshakeClientOnly: boolean, | ||
/** | ||
* | ||
* @private | ||
*/ | ||
_requiredModules: any, | ||
/** | ||
* Use vite-node for on-demand server chunk loading | ||
* @default true | ||
* | ||
* @deprecated use `vite.devBundler: 'vite-node'` | ||
*/ | ||
viteNode: boolean, | ||
/** | ||
* | ||
* @private | ||
*/ | ||
_nuxtConfigFile: any, | ||
/** | ||
* Split server bundle into multiple chunks and dynamically import them. | ||
* @default true | ||
* | ||
* @see https://github.com/nuxt/framework/issues/6432 | ||
*/ | ||
viteServerDynamicImports: boolean, | ||
/** | ||
* | ||
* @private | ||
*/ | ||
_nuxtConfigFiles: Array<any>, | ||
/** | ||
* Inline styles when rendering HTML (currently vite only). | ||
* You can also pass a function that receives the path of a Vue component and returns a boolean indicating whether to inline the styles for that component. | ||
* @default true | ||
*/ | ||
inlineSSRStyles: boolean | ((id?: string) => boolean), | ||
/** | ||
* @default "" | ||
* | ||
* @private | ||
*/ | ||
appDir: string, | ||
/** | ||
* Turn off rendering of Nuxt scripts and JS resource hints. | ||
* @default false | ||
*/ | ||
noScripts: boolean, | ||
/** | ||
* | ||
* @private | ||
*/ | ||
_installedModules: Array<any>, | ||
/** | ||
* When this option is enabled (by default) payload of pages generated with `nuxt generate` are extracted | ||
* @default false | ||
*/ | ||
payloadExtraction: boolean, | ||
/** | ||
* | ||
* @private | ||
*/ | ||
_modules: Array<any>, | ||
/** | ||
* Enable cross-origin prefetch using the Speculation Rules API. | ||
* @default false | ||
*/ | ||
crossOriginPrefetch: boolean, | ||
/** | ||
* Configuration for Nitro. | ||
* | ||
* | ||
* @see https://nitro.unjs.io/config/ | ||
*/ | ||
nitro: NitroConfig, | ||
/** | ||
* Write early hints when using node server. | ||
* @default false | ||
* | ||
* @note nginx does not support 103 Early hints in the current version. | ||
*/ | ||
writeEarlyHints: boolean, | ||
}, | ||
/** | ||
* Global route options applied to matching server routes. | ||
* | ||
* | ||
* @experimental This is an experimental feature and API may change in the future. | ||
* | ||
* @see https://nitro.unjs.io/config/#routes | ||
*/ | ||
routeRules: NitroConfig['routeRules'], | ||
generate: { | ||
/** | ||
* The routes to generate. | ||
* If you are using the crawler, this will be only the starting point for route generation. This is often necessary when using dynamic routes. | ||
* It can be an array or a function. | ||
* | ||
* @example | ||
* ```js | ||
* routes: ['/users/1', '/users/2', '/users/3'] | ||
* ``` | ||
* | ||
* You can pass a function that returns a promise or a function that takes a callback. It should | ||
* return an array of strings or objects with `route` and (optional) `payload` keys. | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* generate: { | ||
* async routes() { | ||
* const res = await axios.get('https://my-api/users') | ||
* return res.data.map(user => ({ route: '/users/' + user.id, payload: user })) | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
* Or instead: | ||
* ```js | ||
* export default { | ||
* generate: { | ||
* routes(callback) { | ||
* axios | ||
* .get('https://my-api/users') | ||
* .then(res => { | ||
* const routes = res.data.map(user => '/users/' + user.id) | ||
* callback(null, routes) | ||
* }) | ||
* .catch(callback) | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
* | ||
* If `routes()` returns a payload, it can be accessed from the Nuxt context. | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* async useAsyncData ({ params, error, payload }) { | ||
* if (payload) return { user: payload } | ||
* else return { user: await backend.fetchUser(params.id) } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
routes: Array<any>, | ||
/** | ||
* Nitro server handlers. | ||
* | ||
* Each handler accepts the following options: - handler: The path to the file defining the handler. - route: The route under which the handler is available. This follows the conventions of https://github.com/unjs/radix3. - method: The HTTP method of requests that should be handled. - middleware: Specifies whether it is a middleware handler. - lazy: Specifies whether to use lazy loading to import the handler. | ||
* | ||
* | ||
* @see https://nuxt.com/docs/guide/directory-structure/server | ||
* | ||
* @note Files from `server/api`, `server/middleware` and `server/routes` will be automatically registered by Nuxt. | ||
* | ||
* @example | ||
* ```js | ||
* serverHandlers: [ | ||
* { route: '/path/foo/**:name', handler: '~/server/foohandler.ts' } | ||
* ] | ||
* ``` | ||
*/ | ||
serverHandlers: NitroEventHandler[], | ||
/** An array of string or regular expressions that will prevent generation of routes matching them. The routes will still be accessible when `fallback` is set. */ | ||
exclude: Array<any>, | ||
}, | ||
/** | ||
* Nitro development-only server handlers. | ||
* | ||
* | ||
* @see https://nitro.unjs.io/guide/introduction/routing | ||
*/ | ||
devServerHandlers: NitroDevEventHandler[], | ||
postcss: { | ||
/** | ||
* @default 3 | ||
* Options for configuring PostCSS plugins. | ||
* | ||
* @private | ||
* https://postcss.org/ | ||
* | ||
*/ | ||
_majorVersion: number, | ||
plugins: Record<string, any>, | ||
}, | ||
router: { | ||
/** | ||
* @default false | ||
* Additional options passed to `vue-router`. | ||
* | ||
* @private | ||
* Note: Only JSON serializable options should be passed by nuxt config. | ||
* For more control, you can use `app/router.options.ts` file. | ||
* | ||
* | ||
* @see [documentation](https://router.vuejs.org/api/interfaces/routeroptions.html). | ||
*/ | ||
_legacyGenerate: boolean, | ||
options: import('../src/types/router').RouterConfigSerializable, | ||
}, | ||
/** | ||
* Configuration for Nuxt's TypeScript integration. | ||
* | ||
*/ | ||
typescript: { | ||
/** | ||
* @default false | ||
* TypeScript comes with certain checks to give you more safety and analysis of your program. Once you’ve converted your codebase to TypeScript, you can start enabling these checks for greater safety. [Read More](https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html#getting-stricter-checks) | ||
* | ||
* @private | ||
* @default true | ||
*/ | ||
_start: boolean, | ||
strict: boolean, | ||
/** | ||
* @default false | ||
* Include parent workspace in the Nuxt project. Mostly useful for themes and module authors. | ||
* | ||
* @private | ||
*/ | ||
_build: boolean, | ||
/** | ||
* @default false | ||
* | ||
* @private | ||
*/ | ||
_generate: boolean, | ||
includeWorkspace: boolean, | ||
/** | ||
* @default false | ||
* Enable build-time type checking. | ||
* | ||
* @private | ||
*/ | ||
_prepare: boolean, | ||
/** | ||
* 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 to install `typescript` and `vue-tsc` as dev dependencies. | ||
* | ||
* @default false | ||
* | ||
* @private | ||
* @see https://nuxt.com/docs/guide/concepts/typescript | ||
*/ | ||
_cli: boolean, | ||
typeCheck: boolean | 'build', | ||
/** | ||
* You can extend generated `.nuxt/tsconfig.json` using this option. | ||
* | ||
* @private | ||
*/ | ||
_requiredModules: any, | ||
tsConfig: readPackageJSON, | ||
/** | ||
* Generate a `*.vue` shim. | ||
* | ||
* @private | ||
*/ | ||
_nuxtConfigFile: any, | ||
/** | ||
* We recommend instead either enabling [**Take Over Mode**](https://vuejs.org/guide/typescript/overview.html#volar-takeover-mode) or adding TypeScript Vue Plugin (Volar)** 👉 [[Download](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin)]. | ||
* | ||
* @private | ||
* @default true | ||
*/ | ||
_nuxtConfigFiles: Array<any>, | ||
shim: boolean, | ||
}, | ||
/** | ||
* Configuration that will be passed directly to Vite. | ||
* | ||
* See https://vitejs.dev/config for more information. Please note that not all vite options are supported in Nuxt. | ||
* | ||
*/ | ||
vite: ViteConfig, | ||
webpack: { | ||
/** | ||
* @default "" | ||
* Nuxt uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them. | ||
* | ||
* @private | ||
* Set to `true` to enable bundle analysis, or pass an object with options: [for webpack](https://github.com/webpack-contrib/webpack-bundle-analyzer#options-for-plugin) or [for vite](https://github.com/btd/rollup-plugin-visualizer#options). | ||
* | ||
* @default false | ||
* | ||
* @example | ||
* ```js | ||
* analyze: { | ||
* analyzerMode: 'static' | ||
* } | ||
* ``` | ||
*/ | ||
appDir: string, | ||
analyze: boolean | BundleAnalyzerPlugin.Options, | ||
/** | ||
* Enable the profiler in webpackbar. | ||
* | ||
* @private | ||
* It is normally enabled by CLI argument `--profile`. | ||
* | ||
* @default false | ||
* | ||
* @see [webpackbar](https://github.com/unjs/webpackbar#profile). | ||
*/ | ||
_installedModules: Array<any>, | ||
profile: boolean, | ||
/** | ||
* Enables Common CSS Extraction using [Vue Server Renderer guidelines](https://ssr.vuejs.org/guide/css.html). | ||
* | ||
* @private | ||
* Using [extract-css-chunks-webpack-plugin](https://github.com/faceyspacey/extract-css-chunks-webpack-plugin/) under the hood, your CSS will be extracted into separate files, usually one per component. This allows caching your CSS and JavaScript separately and is worth trying if you have a lot of global or shared CSS. | ||
* | ||
* @default true | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* webpack: { | ||
* extractCSS: true, | ||
* // or | ||
* extractCSS: { | ||
* ignoreOrder: true | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
* | ||
* If you want to extract all your CSS to a single file, there is a workaround for this. | ||
* However, note that it is not recommended to extract everything into a single file. | ||
* Extracting into multiple CSS files is better for caching and preload isolation. It | ||
* can also improve page performance by downloading and resolving only those resources | ||
* that are needed. | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* webpack: { | ||
* extractCSS: true, | ||
* optimization: { | ||
* splitChunks: { | ||
* cacheGroups: { | ||
* styles: { | ||
* name: 'styles', | ||
* test: /\.(css|vue)$/, | ||
* chunks: 'all', | ||
* enforce: true | ||
* } | ||
* } | ||
* } | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
_modules: Array<any>, | ||
extractCSS: boolean | PluginOptions, | ||
/** | ||
* Configuration for Nitro. | ||
* Enables CSS source map support (defaults to `true` in development). | ||
* | ||
* @see https://nitro.unjs.io/config/ | ||
* @default false | ||
*/ | ||
nitro: NitroConfig, | ||
cssSourceMap: boolean, | ||
/** | ||
* Global route options applied to matching server routes. | ||
* The polyfill library to load to provide URL and URLSearchParams. | ||
* | ||
* @experimental This is an experimental feature and API may change in the future. | ||
* Defaults to `'url'` ([see package](https://www.npmjs.com/package/url)). | ||
* | ||
* @see https://nitro.unjs.io/config/#routes | ||
* @default "url" | ||
*/ | ||
routeRules: NitroConfig['routeRules'], | ||
serverURLPolyfill: string, | ||
/** | ||
* Nitro server handlers. | ||
* Each handler accepts the following options: - handler: The path to the file defining the handler. - route: The route under which the handler is available. This follows the conventions of https://github.com/unjs/radix3. - method: The HTTP method of requests that should be handled. - middleware: Specifies whether it is a middleware handler. - lazy: Specifies whether to use lazy loading to import the handler. | ||
* Customize bundle filenames. | ||
* | ||
* @see https://v3.nuxtjs.org/guide/features/server-routes | ||
* To understand a bit more about the use of manifests, take a look at [this webpack documentation](https://webpack.js.org/guides/code-splitting/). | ||
* | ||
* @note Files from `server/api`, `server/middleware` and `server/routes` will be automatically registered by Nuxt. | ||
* | ||
* @note Be careful when using non-hashed based filenames in production | ||
* as most browsers will cache the asset and not detect the changes on first load. | ||
* | ||
* This example changes fancy chunk names to numerical ids: | ||
* | ||
* @example | ||
* ```js | ||
* serverHandlers: [ | ||
* { route: '/path/foo/**:name', handler: '~/server/foohandler.ts' } | ||
* ] | ||
* filenames: { | ||
* chunk: ({ isDev }) => (isDev ? '[name].js' : '[id].[contenthash].js') | ||
* } | ||
* ``` | ||
*/ | ||
serverHandlers: NitroEventHandler[], | ||
filenames: { | ||
app: () => any, | ||
/** | ||
* Nitro development-only server handlers. | ||
* | ||
* @see https://nitro.unjs.io/guide/introduction/routing | ||
*/ | ||
devServerHandlers: NitroDevEventHandler[], | ||
chunk: () => any, | ||
postcss: { | ||
/** | ||
* Path to postcss config file. | ||
* @default false | ||
*/ | ||
config: boolean, | ||
css: () => any, | ||
/** | ||
* Options for configuring PostCSS plugins. | ||
* https://postcss.org/ | ||
*/ | ||
plugins: Record<string, any>, | ||
}, | ||
img: () => any, | ||
router: { | ||
/** | ||
* Additional options passed to `vue-router`. | ||
* Note: Only JSON serializable options should be passed by nuxt config. | ||
* For more control, you can use `app/router.options.ts` file. | ||
* | ||
* @see [documentation](https://router.vuejs.org/api/interfaces/routeroptions.html). | ||
*/ | ||
options: import('../src/types/router').RouterConfigSerializable, | ||
}, | ||
font: () => any, | ||
/** Configuration for Nuxt's TypeScript integration. */ | ||
typescript: { | ||
/** | ||
* TypeScript comes with certain checks to give you more safety and analysis of your program. Once you’ve converted your codebase to TypeScript, you can start enabling these checks for greater safety. [Read More](https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html#getting-stricter-checks) | ||
* @default true | ||
*/ | ||
strict: boolean, | ||
/** | ||
* Include parent workspace in the Nuxt project. Mostly useful for themes and module authors. | ||
* @default false | ||
*/ | ||
includeWorkspace: boolean, | ||
/** | ||
* Enable build-time type checking. | ||
* 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 to install `typescript` and `vue-tsc` as dev dependencies. | ||
* @default false | ||
* | ||
* @see https://v3.nuxtjs.org/guide/concepts/typescript#type-checking | ||
*/ | ||
typeCheck: boolean | 'build', | ||
/** You can extend generated `.nuxt/tsconfig.json` using this option. */ | ||
tsConfig: readPackageJSON, | ||
/** | ||
* Generate a `*.vue` shim. | ||
* We recommend instead either enabling [**Take Over Mode**](https://vuejs.org/guide/typescript/overview.html#volar-takeover-mode) or adding TypeScript Vue Plugin (Volar)** 👉 [[Download](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin)]. | ||
* @default true | ||
*/ | ||
shim: boolean, | ||
video: () => any, | ||
}, | ||
/** | ||
* Configuration that will be passed directly to Vite. | ||
* See https://vitejs.dev/config for more information. Please note that not all vite options are supported in Nuxt. | ||
* Customize the options of Nuxt's integrated webpack loaders. | ||
* | ||
*/ | ||
vite: ViteConfig, | ||
loaders: { | ||
file: { | ||
/** @default false */ | ||
esModule: boolean, | ||
}, | ||
webpack: { | ||
/** | ||
* Nuxt uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them. | ||
* Set to `true` to enable bundle analysis, or pass an object with options: [for webpack](https://github.com/webpack-contrib/webpack-bundle-analyzer#options-for-plugin) or [for vite](https://github.com/btd/rollup-plugin-visualizer#options). | ||
* @default false | ||
* | ||
* @example | ||
* ```js | ||
* analyze: { | ||
* analyzerMode: 'static' | ||
* } | ||
* ``` | ||
*/ | ||
analyze: boolean | BundleAnalyzerPlugin.Options, | ||
fontUrl: { | ||
/** @default false */ | ||
esModule: boolean, | ||
/** | ||
* Enable the profiler in webpackbar. | ||
* It is normally enabled by CLI argument `--profile`. | ||
* @default false | ||
* | ||
* @see [webpackbar](https://github.com/unjs/webpackbar#profile). | ||
*/ | ||
profile: boolean, | ||
/** @default 1000 */ | ||
limit: number, | ||
}, | ||
/** | ||
* Enables Common CSS Extraction using [Vue Server Renderer guidelines](https://ssr.vuejs.org/guide/css.html). | ||
* Using [extract-css-chunks-webpack-plugin](https://github.com/faceyspacey/extract-css-chunks-webpack-plugin/) under the hood, your CSS will be extracted into separate files, usually one per component. This allows caching your CSS and JavaScript separately and is worth trying if you have a lot of global or shared CSS. | ||
* @default true | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* webpack: { | ||
* extractCSS: true, | ||
* // or | ||
* extractCSS: { | ||
* ignoreOrder: true | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
* | ||
* If you want to extract all your CSS to a single file, there is a workaround for this. | ||
* However, note that it is not recommended to extract everything into a single file. | ||
* Extracting into multiple CSS files is better for caching and preload isolation. It | ||
* can also improve page performance by downloading and resolving only those resources | ||
* that are needed. | ||
* | ||
* @example | ||
* ```js | ||
* export default { | ||
* webpack: { | ||
* extractCSS: true, | ||
* optimization: { | ||
* splitChunks: { | ||
* cacheGroups: { | ||
* styles: { | ||
* name: 'styles', | ||
* test: /\.(css|vue)$/, | ||
* chunks: 'all', | ||
* enforce: true | ||
* } | ||
* } | ||
* } | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
extractCSS: boolean | PluginOptions, | ||
imgUrl: { | ||
/** @default false */ | ||
esModule: boolean, | ||
/** | ||
* Enables CSS source map support (defaults to `true` in development). | ||
* @default false | ||
*/ | ||
cssSourceMap: boolean, | ||
/** @default 1000 */ | ||
limit: number, | ||
}, | ||
/** | ||
* The polyfill library to load to provide URL and URLSearchParams. | ||
* Defaults to `'url'` ([see package](https://www.npmjs.com/package/url)). | ||
* @default "url" | ||
*/ | ||
serverURLPolyfill: string, | ||
pugPlain: any, | ||
/** | ||
* Customize bundle filenames. | ||
* To understand a bit more about the use of manifests, take a look at [this webpack documentation](https://webpack.js.org/guides/code-splitting/). | ||
* | ||
* @note Be careful when using non-hashed based filenames in production | ||
* as most browsers will cache the asset and not detect the changes on first load. | ||
* | ||
* This example changes fancy chunk names to numerical ids: | ||
* | ||
* @example | ||
* ```js | ||
* filenames: { | ||
* chunk: ({ isDev }) => (isDev ? '[name].js' : '[id].[contenthash].js') | ||
* } | ||
* ``` | ||
*/ | ||
filenames: { | ||
app: () => any, | ||
vue: { | ||
/** @default true */ | ||
productionMode: boolean, | ||
chunk: () => any, | ||
transformAssetUrls: { | ||
/** @default "src" */ | ||
video: string, | ||
css: () => any, | ||
/** @default "src" */ | ||
source: string, | ||
img: () => any, | ||
/** @default "src" */ | ||
object: string, | ||
font: () => any, | ||
/** @default "src" */ | ||
embed: string, | ||
}, | ||
video: () => any, | ||
compilerOptions: { | ||
[key: string]: any | ||
}, | ||
}, | ||
/** Customize the options of Nuxt's integrated webpack loaders. */ | ||
loaders: { | ||
file: { | ||
/** @default false */ | ||
esModule: boolean, | ||
}, | ||
css: { | ||
/** @default 0 */ | ||
importLoaders: number, | ||
fontUrl: { | ||
/** @default false */ | ||
esModule: boolean, | ||
url: { | ||
filter: () => any, | ||
}, | ||
/** @default 1000 */ | ||
limit: number, | ||
}, | ||
/** @default false */ | ||
esModule: boolean, | ||
}, | ||
imgUrl: { | ||
/** @default false */ | ||
esModule: boolean, | ||
cssModules: { | ||
/** @default 0 */ | ||
importLoaders: number, | ||
/** @default 1000 */ | ||
limit: number, | ||
}, | ||
url: { | ||
filter: () => any, | ||
}, | ||
pugPlain: any, | ||
/** @default false */ | ||
esModule: boolean, | ||
vue: { | ||
/** @default true */ | ||
productionMode: boolean, | ||
modules: { | ||
/** @default "[local]_[hash:base64:5]" */ | ||
localIdentName: string, | ||
}, | ||
}, | ||
transformAssetUrls: { | ||
/** @default "src" */ | ||
video: string, | ||
less: any, | ||
/** @default "src" */ | ||
source: string, | ||
sass: { | ||
sassOptions: { | ||
/** @default true */ | ||
indentedSyntax: boolean, | ||
}, | ||
}, | ||
/** @default "src" */ | ||
object: string, | ||
scss: any, | ||
/** @default "src" */ | ||
embed: string, | ||
}, | ||
stylus: any, | ||
compilerOptions: { | ||
[key: string]: any | ||
}, | ||
}, | ||
vueStyle: any, | ||
}, | ||
css: { | ||
/** @default 0 */ | ||
importLoaders: number, | ||
/** | ||
* Add webpack plugins. | ||
* | ||
* | ||
* @example | ||
* ```js | ||
* import webpack from 'webpack' | ||
* import { version } from './package.json' | ||
* // ... | ||
* plugins: [ | ||
* new webpack.DefinePlugin({ | ||
* 'process.VERSION': version | ||
* }) | ||
* ] | ||
* ``` | ||
*/ | ||
plugins: Array<any>, | ||
url: { | ||
filter: () => any, | ||
}, | ||
/** | ||
* Terser plugin options. | ||
* | ||
* Set to false to disable this plugin, or pass an object of options. | ||
* | ||
* | ||
* @see [terser-webpack-plugin documentation](https://github.com/webpack-contrib/terser-webpack-plugin). | ||
* | ||
* @note Enabling sourceMap will leave `//# sourceMappingURL` linking comment at | ||
* the end of each output file if webpack `config.devtool` is set to `source-map`. | ||
*/ | ||
terser: false | BasePluginOptions & DefinedDefaultMinimizerAndOptions<any>, | ||
/** @default false */ | ||
esModule: boolean, | ||
}, | ||
/** | ||
* Hard-replaces `typeof process`, `typeof window` and `typeof document` to tree-shake bundle. | ||
* | ||
* @default false | ||
*/ | ||
aggressiveCodeRemoval: boolean, | ||
cssModules: { | ||
/** @default 0 */ | ||
importLoaders: number, | ||
/** | ||
* OptimizeCSSAssets plugin options. | ||
* | ||
* Defaults to true when `extractCSS` is enabled. | ||
* | ||
* @default false | ||
* | ||
* @see [css-minimizer-webpack-plugin documentation](https://github.com/webpack-contrib/css-minimizer-webpack-plugin). | ||
*/ | ||
optimizeCSS: false | BasePluginOptions0 & DefinedDefaultMinimizerAndOptions0<any>, | ||
url: { | ||
filter: () => any, | ||
}, | ||
/** | ||
* Configure [webpack optimization](https://webpack.js.org/configuration/optimization/). | ||
* | ||
*/ | ||
optimization: false | Configuration['optimization'], | ||
/** @default false */ | ||
esModule: boolean, | ||
/** | ||
* Customize PostCSS Loader. Same options as https://github.com/webpack-contrib/postcss-loader#options | ||
* | ||
*/ | ||
postcss: { | ||
execute: any, | ||
modules: { | ||
/** @default "[local]_[hash:base64:5]" */ | ||
localIdentName: string, | ||
}, | ||
}, | ||
postcssOptions: { | ||
config: any, | ||
less: any, | ||
sass: { | ||
sassOptions: { | ||
/** @default true */ | ||
indentedSyntax: boolean, | ||
}, | ||
}, | ||
scss: any, | ||
stylus: any, | ||
vueStyle: any, | ||
plugins: { | ||
[key: string]: any | ||
}, | ||
}, | ||
/** | ||
* Add webpack plugins. | ||
* | ||
* @example | ||
* ```js | ||
* import webpack from 'webpack' | ||
* import { version } from './package.json' | ||
* // ... | ||
* plugins: [ | ||
* new webpack.DefinePlugin({ | ||
* 'process.VERSION': version | ||
* }) | ||
* ] | ||
* ``` | ||
*/ | ||
plugins: Array<any>, | ||
sourceMap: any, | ||
/** | ||
* Terser plugin options. | ||
* Set to false to disable this plugin, or pass an object of options. | ||
* | ||
* @see [terser-webpack-plugin documentation](https://github.com/webpack-contrib/terser-webpack-plugin). | ||
* | ||
* @note Enabling sourceMap will leave `//# sourceMappingURL` linking comment at | ||
* the end of each output file if webpack `config.devtool` is set to `source-map`. | ||
*/ | ||
terser: false | BasePluginOptions & DefinedDefaultMinimizerAndOptions<any>, | ||
implementation: any, | ||
/** | ||
* Hard-replaces `typeof process`, `typeof window` and `typeof document` to tree-shake bundle. | ||
* @default false | ||
*/ | ||
aggressiveCodeRemoval: boolean, | ||
/** @default "" */ | ||
order: string, | ||
}, | ||
/** | ||
* OptimizeCSSAssets plugin options. | ||
* Defaults to true when `extractCSS` is enabled. | ||
* @default false | ||
* | ||
* @see [css-minimizer-webpack-plugin documentation](https://github.com/webpack-contrib/css-minimizer-webpack-plugin). | ||
*/ | ||
optimizeCSS: false | BasePluginOptions0 & DefinedDefaultMinimizerAndOptions0<any>, | ||
/** | ||
* See [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) for available options. | ||
* | ||
*/ | ||
devMiddleware: Options<IncomingMessage, ServerResponse>, | ||
/** Configure [webpack optimization](https://webpack.js.org/configuration/optimization/). */ | ||
optimization: false | Configuration['optimization'], | ||
/** | ||
* See [webpack-hot-middleware](https://github.com/webpack-contrib/webpack-hot-middleware) for available options. | ||
* | ||
*/ | ||
hotMiddleware: MiddlewareOptions & { client?: ClientOptions }, | ||
/** Customize PostCSS Loader. Same options as https://github.com/webpack-contrib/postcss-loader#options */ | ||
postcss: { | ||
execute: any, | ||
/** | ||
* Set to `false` to disable the overlay provided by [FriendlyErrorsWebpackPlugin](https://github.com/nuxt/friendly-errors-webpack-plugin). | ||
* | ||
* @default true | ||
*/ | ||
friendlyErrors: boolean, | ||
postcssOptions: { | ||
/** @default false */ | ||
config: boolean, | ||
plugins: { | ||
[key: string]: any | ||
}, | ||
}, | ||
sourceMap: any, | ||
implementation: any, | ||
/** @default "" */ | ||
order: string, | ||
}, | ||
/** See [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) for available options. */ | ||
devMiddleware: Options<IncomingMessage, ServerResponse>, | ||
/** See [webpack-hot-middleware](https://github.com/webpack-contrib/webpack-hot-middleware) for available options. */ | ||
hotMiddleware: MiddlewareOptions & { client?: ClientOptions }, | ||
/** | ||
* Set to `false` to disable the overlay provided by [FriendlyErrorsWebpackPlugin](https://github.com/nuxt/friendly-errors-webpack-plugin). | ||
* @default true | ||
*/ | ||
friendlyErrors: boolean, | ||
/** Filters to hide build warnings. */ | ||
warningIgnoreFilters: Array<(warn: WebpackError) => boolean>, | ||
}, | ||
/** | ||
* Filters to hide build warnings. | ||
* | ||
*/ | ||
warningIgnoreFilters: Array<(warn: WebpackError) => boolean>, | ||
}, | ||
} |
@@ -7,3 +7,3 @@ { | ||
"mode": "production", | ||
"logLevel": "warn", | ||
"logLevel": "info", | ||
"define": { | ||
@@ -53,3 +53,3 @@ "process.dev": false | ||
"/<rootDir>/node_modules", | ||
"/Users/pooya/Code/framework/packages/schema/node_modules" | ||
"/Users/daniel/code/nuxt.js/packages/schema/node_modules" | ||
] | ||
@@ -122,3 +122,3 @@ } | ||
"/<rootDir>/node_modules", | ||
"/Users/pooya/Code/framework/packages/schema/node_modules" | ||
"/Users/daniel/code/nuxt.js/packages/schema/node_modules" | ||
], | ||
@@ -198,3 +198,5 @@ "builder": "@nuxt/vite-builder", | ||
"crossOriginPrefetch": false, | ||
"writeEarlyHints": false | ||
"writeEarlyHints": false, | ||
"componentIslands": false, | ||
"configSchema": false | ||
}, | ||
@@ -225,3 +227,2 @@ "generate": { | ||
"postcss": { | ||
"config": false, | ||
"plugins": { | ||
@@ -324,3 +325,3 @@ "postcss-import": {}, | ||
"postcssOptions": { | ||
"config": false, | ||
"config": {}, | ||
"plugins": { | ||
@@ -327,0 +328,0 @@ "postcss-import": {}, |
@@ -16,3 +16,5 @@ | ||
> An array of custom directories that will be auto-imported. Note that this option will not override the default directories (~/composables, ~/utils). | ||
# `pages` | ||
@@ -149,3 +151,3 @@ - **Type**: `boolean` | ||
## `transpile` | ||
- **Type**: `Array<string | RegExp | Function>` | ||
- **Type**: `Array<string | RegExp | ((ctx: { isClient?: boolean; isServer?: boolean; isDev: boolean }) => string | RegExp | false)>` | ||
- **Default**: `[]` | ||
@@ -255,3 +257,3 @@ | ||
- **Type**: `array` | ||
- **Default**: `["/<rootDir>/node_modules","/Users/pooya/Code/framework/packages/schema/node_modules"]` | ||
- **Default**: `["/<rootDir>/node_modules","/Users/daniel/code/nuxt.js/packages/schema/node_modules"]` | ||
@@ -547,2 +549,16 @@ > Used to set the modules directories for path resolving (for example, webpack's `resolveLoading`, `nodeExternals` and `postcss`). | ||
## `componentIslands` | ||
- **Type**: `boolean` | ||
- **Default**: `false` | ||
> Experimental component islands support with <NuxtIsland> and .island.vue files. | ||
## `configSchema` | ||
- **Type**: `boolean` | ||
- **Default**: `false` | ||
> Enable experimental config schema support | ||
# `generate` | ||
@@ -558,3 +574,3 @@ | ||
If you are using the crawler, this will be only the starting point for route generation. This is often necessary when using dynamic routes. | ||
It can be an array or a function. | ||
It is preferred to use `nitro.prerender.routes`. | ||
@@ -566,3 +582,3 @@ | ||
> An array of string or regular expressions that will prevent generation of routes matching them. The routes will still be accessible when `fallback` is set. | ||
> This option is no longer used. Instead, use `nitro.prerender.ignore`. | ||
@@ -665,9 +681,2 @@ | ||
## `config` | ||
- **Type**: `boolean` | ||
- **Default**: `false` | ||
> Path to postcss config file. | ||
## `plugins` | ||
@@ -766,3 +775,3 @@ | ||
- **Type**: `string` | ||
- **Default**: `"warn"` | ||
- **Default**: `"info"` | ||
@@ -842,3 +851,3 @@ | ||
- **Type**: `array` | ||
- **Default**: `["/<rootDir>/.nuxt","/<rootDir>","/<rootDir>","/<rootDir>","/<rootDir>/node_modules","/Users/pooya/Code/framework/packages/schema/node_modules"]` | ||
- **Default**: `["/<rootDir>/.nuxt","/<rootDir>","/<rootDir>","/<rootDir>","/<rootDir>/node_modules","/Users/daniel/code/nuxt.js/packages/schema/node_modules"]` | ||
@@ -1184,4 +1193,4 @@ | ||
#### `config` | ||
- **Type**: `boolean` | ||
- **Default**: `false` | ||
- **Type**: `any` | ||
- **Default**: `{}` | ||
@@ -1188,0 +1197,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
273204
7744
129
13
1
+ Addedhookable@^5.4.2
+ Addedhookable@5.5.3(transitive)
+ Addedunimport@2.2.4(transitive)
+ Addedunplugin@1.16.0(transitive)
- Removedunimport@1.3.0(transitive)
- Removedunplugin@1.15.0(transitive)
Updatedc12@^1.1.0
Updatedjiti@^1.16.2
Updatedufo@^1.0.1
Updatedunimport@^2.0.1
Updateduntyped@^1.2.2