Overview
The module's surface is small: a handful of options in nuxt.config.ts, one function your scripts export, and one virtual module their results land in.
Configuration
- Module Configuration – Which scripts run, when, and what a failure does to the build.
Methods
Imported from nuxt-prepare/config in every prepare script:
defineNuxtPrepareHandler– Wraps the handler and types its result.
ts
// `server.prepare.ts`
import { defineNuxtPrepareHandler } from 'nuxt-prepare/config'
export default defineNuxtPrepareHandler(async () => ({
runtimeConfig: { public: { apiUrl: await resolveApiUrl() } },
state: { buildRegion: 'eu-central-1' }
}))A result carries ok, runtimeConfig, appConfig and state, each optional. defineNuxtPrepareHandler documents what each one does.
Virtual Module
Whatever your scripts returned as state is importable by key, typed from the value itself:
ts
import { buildRegion } from '#nuxt-prepare'
// ^? "eu-central-1"See Prepare State.