Install specified Nuxt module programmatically. This is helpful when your module depends on other modules. You can pass the module options as an object to `inlineOptions` and they will be passed to the module's `setup` function.
Programmatic usage can be helpfull when you want to use Nuxt programmatically, for example, when building a [CLI tool](https://github.com/nuxt/cli) or [test utils](https://github.com/nuxt/nuxt/tree/main/packages/test-utils).
Loading conditions for Nuxt. `loadNuxt` uses [`c12`](https://github.com/unjs/c12) under the hood, so it accepts the same options as `c12.loadConfig` with some additional options:
If set to `true`, Nuxt will be loaded in development mode.
-`ready` (optional)
**Type**: `boolean`
**Default**: `true`
If set to `true`, Nuxt will be ready to use after the `loadNuxt` call. If set to `false`, you will need to call `nuxt.ready()` to make sure Nuxt is ready to use.
Build Nuxt programmatically. It will invoke the builder (currently [@nuxt/vite-builder](https://github.com/nuxt/nuxt/tree/main/packages/vite) or [@nuxt/webpack-builder](https://github.com/nuxt/nuxt/tree/main/packages/webpack)) to bundle the application.
Constraints to check for. It accepts the following properties:
-`nuxt` (optional)
**Type**: `string`ч
Nuxt version in semver format. Versions may be defined in Node.js way, for exmaple: `>=2.15.0 <3.0.0`.
-`bridge` (optional)
**Type**: `boolean`
If set to `true`, it will check if the current Nuxt version supports `bridge`.
##### `nuxt`
**Type**: `Nuxt`
**Default**: `useNuxt()`
Nuxt instance. If not provided, it will be retrieved from the context via `useNuxt()` call.
### `assertNuxtCompatibility`
Asserts that constraints are met for the current Nuxt version. If not, throws an error with the list of issues as string.
#### Type
```ts
async function assertNuxtCompatibility(
constraints: NuxtCompatibility,
nuxt?: Nuxt
): Promise<true>;
interface NuxtCompatibility {
nuxt?: string;
bridge?: boolean;
}
```
#### Parameters
##### `constraints`
**Type**: `NuxtCompatibility`
**Default**: `{}`
Constraints to check for. It accepts the following properties:
-`nuxt` (optional)
**Type**: `string`ч
Nuxt version in semver format. Versions may be defined in Node.js way, for exmaple: `>=2.15.0 <3.0.0`.
-`bridge` (optional)
**Type**: `boolean`
If set to `true`, it will check if the current Nuxt version supports `bridge`.
##### `nuxt`
**Type**: `Nuxt`
**Default**: `useNuxt()`
Nuxt instance. If not provided, it will be retrieved from the context via `useNuxt()` call.
### `hasNuxtCompatibility`
Checks if constraints are met for the current Nuxt version. Return `true` if all constraints are met, otherwise returns `false`. Nuxt 2 version also checks for `bridge` support.
#### Type
```ts
async function hasNuxtCompatibility(
constraints: NuxtCompatibility,
nuxt?: Nuxt
): Promise<boolean>;
interface NuxtCompatibility {
nuxt?: string;
bridge?: boolean;
}
```
#### Parameters
##### `constraints`
**Type**: `NuxtCompatibility`
**Default**: `{}`
Constraints to check for. It accepts the following properties:
-`nuxt` (optional)
**Type**: `string`ч
Nuxt version in semver format. Versions may be defined in Node.js way, for exmaple: `>=2.15.0 <3.0.0`.
-`bridge` (optional)
**Type**: `boolean`
If set to `true`, it will check if the current Nuxt version supports `bridge`.
##### `nuxt`
**Type**: `Nuxt`
**Default**: `useNuxt()`
Nuxt instance. If not provided, it will be retrieved from the context via `useNuxt()` call.
### `isNuxt2`
Checks if the current Nuxt version is 2.x.
#### Type
```ts
function isNuxt2(nuxt?: Nuxt): boolean;
```
#### Parameters
##### `nuxt`
**Type**: `Nuxt`
**Default**: `useNuxt()`
Nuxt instance. If not provided, it will be retrieved from the context via `useNuxt()` call.
### `isNuxt3`
Checks if the current Nuxt version is 3.x.
#### Type
```ts
function isNuxt3(nuxt?: Nuxt): boolean;
```
#### Parameters
##### `nuxt`
**Type**: `Nuxt`
**Default**: `useNuxt()`
Nuxt instance. If not provided, it will be retrieved from the context via `useNuxt()` call.
### `getNuxtVersion`
Returns the current Nuxt version.
#### Type
```ts
function getNuxtVersion(nuxt?: Nuxt): string;
```
#### Parameters
##### `nuxt`
**Type**: `Nuxt`
**Default**: `useNuxt()`
Nuxt instance. If not provided, it will be retrieved from the context via `useNuxt()` call.
If you are building an integration that needs access to the runtime Vite or webpack config that Nuxt uses, it is possible to extract this using Kit utilities.
Here is a brief example of how you might access the Vite config from a project; you could implement a similar approach to get the webpack configuration.