Custom build preset (advanced)

Get full control of Nuxt Nitro output to deploy on any kind of hosting platform.

create a custom preset - 图1 Allows full customization

create a custom preset - 图2 This is an advanced usage pattern

create a custom preset - 图3

Back to presets list.

Setup

You can create your own custom-built preset. See the provided presets for examples.

Inline preset definition

You can define everything that a custom preset would configure directly in the Nitro options:

nuxt.config.js|ts

  1. export default {
  2. nitro: {
  3. // preset options
  4. }
  5. }

Reusable preset

You can also define a preset in a separate file (or publish it as a separate npm package).

my-preset/index.ts

  1. import type { NitroPreset } from 'nitropack'
  2. const myPreset: NitroPreset = {
  3. // Your custom configuration
  4. }
  5. export default myPreset

Then in your nuxt.config you can specify that Nitro should use your custom preset:

nuxt.config.js|ts

  1. import { resolve } from 'node:path'
  2. export default {
  3. nitro: {
  4. preset: resolve(__dirname, 'my-preset')
  5. }
  6. }