网页 综合 更新时间 2026-11-14 01:31:59

Nuxt Configuration v4

自动蜘蛛 nuxt.com 正文约 3059 字
Nuxt Configuration v4
You can improve your DX by defining additional aliases to access custom directories within your JavaScript and CSS.
Note: These aliases will be automatically added to the generated TypeScript configurations (.nuxt/tsconfig.app.json, .nuxt/tsconfig.server.json, etc.) so you can get full type support and path auto-complete. In case you need to extend options provided by the generated configurations further, make sure to add them here or within the typescript.tsConfig property in nuxt.config.
The directory where Nuxt will store the generated files when running nuxt analyze.
If a relative path is specified, it will be relative to your rootDir.
Nuxt App configuration.
The base path of your Nuxt application.
This can also be set at runtime by setting the NUXT_APP_BASE_URL environment variable.
Relative paths (like ./) are not supported directly in nuxt.config.ts due to Nitro limitations. For static hosting with relative asset paths, use one of these approaches:
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.
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.
Set default configuration for <head> on every page.
Default values for KeepAlive configuration between pages.
This can be overridden with definePageMeta on an individual page. Only JSON-serializable values are allowed.
Default values for layout transitions.
This can be overridden with definePageMeta on an individual page. Only JSON-serializable values are allowed.
See: Vue Transition docs
Default values for page transitions.
This can be overridden with definePageMeta on an individual page. Only JSON-serializable values are allowed.
See: Vue Transition docs
Customize Nuxt root element id.
Customize Nuxt root element id.
Customize Nuxt root element tag.
Customize Nuxt SPA loading template element attributes.
Customize Nuxt SpaLoader element tag.
Customize Nuxt Teleport element attributes.
Customize Nuxt Teleport element id.
Customize Nuxt Teleport element tag.
Default values for view transitions.
This only has an effect when experimental support for View Transitions is enabled in your nuxt.config file. This can be overridden with definePageMeta on an individual page.
See: Nuxt View Transition API docs
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.
For multi-app projects, the unique id of the Nuxt application.
Defaults to nuxt-app.
Shared build configuration.
Nuxt allows visualizing your bundles and how to optimize them.
Set to true to enable bundle analysis, or pass an object with options: for webpack or for vite.
With the Rsbuild builder, Nuxt writes an Rsdoctor report to filename unless enabled is false, and ignores the other options.
It is recommended to use addTemplate from @nuxt/kit instead of this option.
访问原文 返回搜索 https://nuxt.com/docs/api/nuxt-config
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。