@nuxt/docs-nightly 4.2.0-29338985.3c38d1f8 → 4.2.0-29344151.f836eca0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/3.api/6.nuxt-config.md +69 -1
- package/package.json +1 -1
package/3.api/6.nuxt-config.md
CHANGED
|
@@ -424,9 +424,60 @@ A unique identifier matching the build. This may contain the hash of the current
|
|
|
424
424
|
|
|
425
425
|
The builder to use for bundling the Vue part of your application.
|
|
426
426
|
|
|
427
|
-
-
|
|
427
|
+
Nuxt supports multiple builders for the client-side application. By default, Vite is used, but you can switch to webpack, Rspack, or even provide a custom builder implementation.
|
|
428
|
+
|
|
429
|
+
- **Type**: `'vite' | 'webpack' | 'rspack' | string | { bundle: (nuxt: Nuxt) => Promise<void> }`
|
|
428
430
|
- **Default:** `"@nuxt/vite-builder"`
|
|
429
431
|
|
|
432
|
+
**Using supported builders:**
|
|
433
|
+
|
|
434
|
+
```ts
|
|
435
|
+
export default defineNuxtConfig({
|
|
436
|
+
// default - uses @nuxt/vite-builder
|
|
437
|
+
// builder: 'vite',
|
|
438
|
+
|
|
439
|
+
// uses @nuxt/webpack-builder
|
|
440
|
+
// builder: 'webpack',
|
|
441
|
+
|
|
442
|
+
// uses @nuxt/rspack-builder
|
|
443
|
+
builder: 'rspack',
|
|
444
|
+
})
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
If you are using `webpack` or `rspack` you will need to make sure `@nuxt/webpack-builder` or `@nuxt/rspack-builder` is explicitly installed in your project.
|
|
448
|
+
|
|
449
|
+
**Using a custom builder object:**
|
|
450
|
+
|
|
451
|
+
You can provide a custom builder by passing an object with a `bundle` function:
|
|
452
|
+
|
|
453
|
+
```ts
|
|
454
|
+
export default defineNuxtConfig({
|
|
455
|
+
builder: {
|
|
456
|
+
async bundle (nuxt) {
|
|
457
|
+
const entry = await resolvePath(resolve(nuxt.options.appDir, 'entry'))
|
|
458
|
+
|
|
459
|
+
// Build client and server bundles
|
|
460
|
+
await buildClient(nuxt, entry)
|
|
461
|
+
if (nuxt.options.ssr) {
|
|
462
|
+
await buildServer(nuxt, entry)
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// ... it's a bit more complicated than that, of course!
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
})
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
**Creating a custom builder package:**
|
|
472
|
+
|
|
473
|
+
To create a custom builder as a separate package, it should export a `bundle` function. You can then specify the package name in your `nuxt.config.ts`:
|
|
474
|
+
|
|
475
|
+
```ts
|
|
476
|
+
export default defineNuxtConfig({
|
|
477
|
+
builder: 'my-custom-builder',
|
|
478
|
+
})
|
|
479
|
+
```
|
|
480
|
+
|
|
430
481
|
## compatibilityDate
|
|
431
482
|
|
|
432
483
|
Specify a compatibility date for your app.
|
|
@@ -1218,6 +1269,23 @@ export default defineNuxtConfig({
|
|
|
1218
1269
|
})
|
|
1219
1270
|
```
|
|
1220
1271
|
|
|
1272
|
+
## server
|
|
1273
|
+
|
|
1274
|
+
Configuration for Nuxt's server builder.
|
|
1275
|
+
|
|
1276
|
+
### `builder`
|
|
1277
|
+
|
|
1278
|
+
Specify the server builder to use for bundling the server part of your application.
|
|
1279
|
+
|
|
1280
|
+
By default, Nuxt uses `@nuxt/nitro-server`, which provides standalone Nitro integration. This architecture allows for different Nitro integration patterns, such as using Nitro as a Vite plugin (with the Vite Environment API).
|
|
1281
|
+
|
|
1282
|
+
- **Type**: `string | { bundle: (nuxt: Nuxt) => Promise<void> }`
|
|
1283
|
+
- **Default:** `"@nuxt/nitro-server"`
|
|
1284
|
+
|
|
1285
|
+
::callout{type="warning"}
|
|
1286
|
+
This option is intended for internal use and the API is not finalized. Please open an issue before relying on the current implementation.
|
|
1287
|
+
::
|
|
1288
|
+
|
|
1221
1289
|
## serverDir
|
|
1222
1290
|
|
|
1223
1291
|
Define the server directory of your Nuxt application, where Nitro routes, middleware and plugins are kept.
|