2023-10-18 10:59:43 +00:00
|
|
|
---
|
|
|
|
title: Configuration
|
|
|
|
description: 'Learn how to configure Nuxt Bridge to your own needs.'
|
|
|
|
---
|
2023-08-29 09:55:59 +00:00
|
|
|
|
|
|
|
## Feature Flags
|
|
|
|
|
|
|
|
You can optionally disable some features from bridge or opt-in to less stable ones. In normal circumstances, it is always best to stick with defaults!
|
|
|
|
|
|
|
|
You can check [bridge/src/module.ts](https://github.com/nuxt/bridge/blob/main/packages/bridge/src/module.ts) for latest defaults.
|
|
|
|
|
2023-10-18 10:59:43 +00:00
|
|
|
```ts [nuxt.config.ts]
|
2023-08-29 09:55:59 +00:00
|
|
|
import { defineNuxtConfig } from '@nuxt/bridge'
|
|
|
|
export default defineNuxtConfig({
|
|
|
|
bridge: {
|
|
|
|
|
|
|
|
// -- Opt-in features --
|
|
|
|
|
|
|
|
// Use Vite as the bundler instead of webpack 4
|
|
|
|
// vite: true,
|
|
|
|
|
|
|
|
// Enable Nuxt 3 compatible useHead
|
|
|
|
// meta: true,
|
|
|
|
|
2024-03-08 07:21:56 +00:00
|
|
|
// Enable definePageMeta macro
|
|
|
|
// macros: {
|
|
|
|
// pageMeta: true
|
|
|
|
// },
|
|
|
|
|
|
|
|
// Enable transpiling TypeScript with esbuild
|
|
|
|
// typescript: {
|
|
|
|
// esbuild: true
|
|
|
|
// },
|
|
|
|
|
2023-08-29 09:55:59 +00:00
|
|
|
// -- Default features --
|
|
|
|
|
|
|
|
// Use legacy server instead of Nitro
|
|
|
|
// nitro: false,
|
|
|
|
|
|
|
|
// Disable Nuxt 3 compatible `nuxtApp` interface
|
|
|
|
// app: false,
|
|
|
|
|
|
|
|
// Disable Composition API support
|
|
|
|
// capi: false,
|
|
|
|
|
|
|
|
// ... or just disable legacy Composition API support
|
|
|
|
// capi: {
|
|
|
|
// legacy: false
|
|
|
|
// },
|
|
|
|
|
|
|
|
// Do not transpile modules
|
|
|
|
// transpile: false,
|
|
|
|
|
|
|
|
// Disable <script setup> support
|
|
|
|
// scriptSetup: false,
|
|
|
|
|
|
|
|
// Disable composables auto importing
|
|
|
|
// imports: false,
|
|
|
|
|
|
|
|
// Do not warn about module incompatibilities
|
|
|
|
// constraints: false
|
|
|
|
},
|
|
|
|
|
|
|
|
vite: {
|
|
|
|
// Config for Vite
|
|
|
|
}
|
|
|
|
})
|
|
|
|
```
|
|
|
|
|
|
|
|
## Migration of each option
|
|
|
|
|
|
|
|
### 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'
|
|
|
|
+ }
|
|
|
|
})
|
|
|
|
```
|