2023-10-18 10:59:43 +00:00
---
title: Overview
description: Reduce the differences with Nuxt 3 and reduce the burden of migration to Nuxt 3.
---
2021-10-11 12:57:54 +00:00
2023-10-18 10:59:43 +00:00
::callout
2022-11-16 10:04:28 +00:00
If you're starting a fresh Nuxt 3 project, please skip this section and go to [Nuxt 3 Installation ](/docs/getting-started/introduction ).
2021-10-11 16:37:38 +00:00
::
2021-10-11 12:57:54 +00:00
2023-10-18 10:59:43 +00:00
::callout{color="amber" icon="i-ph-warning-duotone"}
2023-07-07 16:24:09 +00:00
Nuxt Bridge provides identical features to Nuxt 3 ([docs](/docs/guide/concepts/auto-imports)) but there are some limitations, notably that [`useAsyncData` ](/docs/api/composables/use-async-data ) and [`useFetch` ](/docs/api/composables/use-fetch ) composables are not available. Please read the rest of this page for details.
2021-11-04 11:20:40 +00:00
::
2021-11-21 12:31:44 +00:00
Bridge is a forward-compatibility layer that allows you to experience many of the new Nuxt 3 features by simply installing and enabling a Nuxt module.
2021-10-11 12:57:54 +00:00
2023-08-29 09:55:59 +00:00
Using Nuxt Bridge, you can make sure your project is (almost) ready for Nuxt 3 and you can gradually proceed with the transition to Nuxt 3.
2021-10-11 12:57:54 +00:00
2023-08-29 09:55:59 +00:00
## First Step
### Upgrade Nuxt 2
2021-10-11 16:37:38 +00:00
2023-02-06 22:41:31 +00:00
Make sure your dev server (`nuxt dev`) isn't running, remove any package lock files (`package-lock.json` and `yarn.lock` ), and install the latest Nuxt 2 version:
2021-10-11 12:57:54 +00:00
2021-10-29 11:26:01 +00:00
```diff [package.json]
2023-06-22 11:36:07 +00:00
- "nuxt": "^2.16.3"
+ "nuxt": "^2.17.0"
2021-10-11 12:57:54 +00:00
```
2021-10-11 21:49:54 +00:00
Then, reinstall your dependencies:
2021-10-11 12:57:54 +00:00
2021-10-11 16:37:38 +00:00
::code-group
2021-10-29 11:26:01 +00:00
2023-10-18 10:59:43 +00:00
```bash [yarn]
2021-10-11 16:37:38 +00:00
yarn install
```
2021-10-29 11:26:01 +00:00
2022-12-05 10:44:28 +00:00
```bash [npm]
2021-10-11 16:37:38 +00:00
npm install
```
2021-10-29 11:26:01 +00:00
2021-10-11 16:37:38 +00:00
::
2021-10-11 12:57:54 +00:00
2023-10-18 10:59:43 +00:00
::callout
2021-10-11 21:49:54 +00:00
Once the installation is complete, make sure both development and production builds are working as expected before proceeding.
2021-10-11 16:37:38 +00:00
::
2021-10-11 12:57:54 +00:00
2023-08-29 09:55:59 +00:00
### Install Nuxt Bridge
2021-10-11 12:57:54 +00:00
2021-10-11 16:37:38 +00:00
Install `@nuxt/bridge-edge` as a development dependency:
::code-group
2021-10-29 11:26:01 +00:00
2021-10-11 16:37:38 +00:00
```bash [Yarn]
2021-10-11 12:57:54 +00:00
yarn add --dev @nuxt/bridge@npm:@nuxt/bridge -edge
2021-10-12 19:58:42 +00:00
```
2021-10-29 11:26:01 +00:00
2022-12-05 10:44:28 +00:00
```bash [npm]
2021-10-12 19:58:42 +00:00
npm install -D @nuxt/bridge@npm:@nuxt/bridge -edge
2021-10-11 12:57:54 +00:00
```
2021-10-29 11:26:01 +00:00
2021-10-11 16:37:38 +00:00
::
2023-08-29 09:55:59 +00:00
### Update `nuxt.config`
2021-10-11 12:57:54 +00:00
2021-10-11 21:49:54 +00:00
Please make sure to avoid any CommonJS syntax such as `module.exports` , `require` or `require.resolve` in your config file. It will soon be deprecated and unsupported.
2021-10-11 12:57:54 +00:00
2023-07-07 16:24:09 +00:00
You can use static `import` , dynamic `import()` and `export default` instead. Using TypeScript by renaming to [`nuxt.config.ts` ](/docs/guide/directory-structure/nuxt.config ) is also possible and recommended.
2021-10-11 12:57:54 +00:00
2023-10-18 10:59:43 +00:00
```ts [nuxt.config.ts]
2021-10-11 12:57:54 +00:00
import { defineNuxtConfig } from '@nuxt/bridge'
export default defineNuxtConfig({
2023-08-29 09:55:59 +00:00
bridge: false
2021-11-04 11:20:40 +00:00
})
```
2023-09-14 11:56:38 +00:00
### Update Commands
The `nuxt` command should now be changed to the `nuxt2` command.
```diff
{
"scripts": {
- "dev": "nuxt",
+ "dev": "nuxt2",
- "build": "nuxt build",
+ "build": "nuxt2 build",
- "start": "nuxt start",
+ "start": "nuxt2 start"
}
}
```
Try running `nuxt2` once here. You will see that the application works as before.
2021-11-02 11:53:11 +00:00
2023-08-29 09:55:59 +00:00
(If 'bridge' is set to false, your application will operate without any changes as before.)
2021-11-02 11:53:11 +00:00
2023-08-29 09:55:59 +00:00
## Upgrade Steps
2021-11-02 11:53:11 +00:00
2023-08-29 09:55:59 +00:00
With Nuxt Bridge, the migration to Nuxt 3 can proceed in steps.
The below `Upgrade Steps` does not need to be done all at once.
2021-11-02 11:53:11 +00:00
2023-08-29 09:55:59 +00:00
- [TypeScript ](/docs/bridge/typescript )
2021-11-02 11:53:11 +00:00
2023-08-29 09:55:59 +00:00
- [Migrate Legacy Composition API ](/docs/bridge/bridge-composition-api )
2021-11-02 11:53:11 +00:00
2023-08-29 09:55:59 +00:00
- [Plugins and Middleware ](/docs/bridge/plugins-and-middleware )
2021-11-04 11:20:40 +00:00
2023-08-29 09:55:59 +00:00
- [Migrate New Composition API ](/docs/bridge/nuxt3-compatible-api )
2021-11-02 11:53:11 +00:00
2023-08-29 09:55:59 +00:00
- [Meta Tags ](/docs/bridge/meta )
2021-11-02 11:53:11 +00:00
2023-08-29 09:55:59 +00:00
- [Runtime Config ](/docs/bridge/runtime-config )
2021-11-02 11:53:11 +00:00
2023-08-29 09:55:59 +00:00
- [Nitro ](/docs/bridge/nitro )
2021-11-02 11:53:11 +00:00
2023-08-29 09:55:59 +00:00
- [Vite ](/docs/bridge/vite )
2021-12-17 09:44:59 +00:00
2023-08-29 09:55:59 +00:00
## Migrate from CommonJS to ESM
2021-11-02 11:53:11 +00:00
2023-08-29 09:55:59 +00:00
Nuxt 3 natively supports TypeScript and ECMAScript Modules. Please check [Native ES Modules ](/docs/guide/concepts/esm ) for more info and upgrading.