@nuxt/nitro: Bridge injects same functionalityimport { defineNuxtConfig } from '@nuxt/bridge'
export default defineNuxtConfig({
bridge: {
nitro: true
}
})
You will also need to update your scripts within your package.json to reflect the fact that Nuxt will now produce a Nitro server as build output.
Install nuxi as a development dependency:
npm install -D nuxi
yarn add --dev nuxi
Nuxt 3 introduced the new Nuxt CLI command nuxi. Update your scripts as follows to leverage the better support from Nuxt Bridge:
{
"scripts": {
- "dev": "nuxt",
+ "dev": "nuxi dev",
- "build": "nuxt build",
+ "build": "nuxi build",
- "start": "nuxt start",
+ "start": "nuxi preview"
}
}
If nitro: false, use the nuxt2 command.
If you have set target: 'static' in your nuxt.config then you need to ensure that you update your build script to be nuxi generate.
{
"scripts": {
"build": "nuxi generate"
}
}
For all other situations, you can use the nuxi build command.
{
"scripts": {
"build": "nuxi build",
"start": "nuxi preview"
}
}
Add the folder .output to the .gitignore file.
✔️ Try with nuxi dev and nuxi build (or nuxi generate) to see if everything goes well.
[
{
"title": "Runtime Config",
"path": "/nuxt/bridge/runtime-config",
"stem": "nuxt/6.bridge/7.runtime-config",
"description": "Nuxt provides a runtime config API to expose configuration and secrets within your application."
},
{
"title": "Vite",
"path": "/nuxt/bridge/vite",
"stem": "nuxt/6.bridge/9.vite",
"description": "Activate Vite to your Nuxt 2 application with Nuxt Bridge."
}
]