---
title: "配置"
description: "了解如何根据自己的需求配置 Nuxt Bridge。"
canonical_url: "https://nuxt.zhcndoc.com/docs/3.x/bridge/configuration"
---
# 配置

> 了解如何根据自己的需求配置 Nuxt Bridge。

## 特性开关

你可以选择性地禁用桥接中的某些功能，或选择使用不太稳定的功能。在正常情况下，最好始终坚持使用默认设置！

你可以查看 [bridge/src/module.ts](https://github.com/nuxt/bridge/blob/main/packages/bridge/src/module.ts) 以获取最新的默认值。

```ts [nuxt.config.ts]
import { defineNuxtConfig } from '@nuxt/bridge'

export default defineNuxtConfig({
  bridge: {

    // -- 选择性启用的功能 --

    // 使用 Vite 作为打包工具，替代 webpack 4
    // vite: true,

    // 启用兼容 Nuxt 3 的 useHead
    // meta: true,

    // 启用 definePageMeta 宏
    // macros: {
    //   pageMeta: true
    // },

    // 使用 esbuild 转译 TypeScript
    // typescript: {
    //   esbuild: true
    // },

    // -- 默认启用的功能 --

    // 使用传统服务器，替代 Nitro
    // nitro: false,

    // 禁用兼容 Nuxt 3 的 `nuxtApp` 接口
    // app: false,

    // 禁用 Composition API 支持
    // capi: false,

    // ... 或者仅禁用传统的 Composition API 支持
    // capi: {
    //   legacy: false
    // },

    // 不转译模块
    // transpile: false,

    // 禁用 <script setup> 支持
    // scriptSetup: false,

    // 禁用自动导入组合函数
    // imports: false,

    // 不显示模块不兼容的警告
    // constraints: false
  },

  vite: {
    // Vite 配置
  },
})
```

## 每个选项的迁移

### router.base

```diff
export default defineNuxtConfig({
- router: {
-   base: '/my-app/'
- }
+ app: {
+   baseURL: '/my-app/'
+ }
})
```

### build.publicPath

```diff
export default defineNuxtConfig({
- build: {
-   publicPath: 'https://my-cdn.net'
- }
+ app: {
+   cdnURL: 'https://my-cdn.net'
+ }
})
```


## Sitemap

See the full [sitemap](https://nuxt.zhcndoc.com/sitemap.md) for all pages.
