Skip to content

Commit

Permalink
fix: expose nitro instance via kit useNitro
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Sep 21, 2022
1 parent 4585eb0 commit 378ce3d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/nitro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { distDir } from './dirs'
import { isDirectory, readDirRecursively } from './vite/utils/fs'

export async function setupNitroBridge () {
const nuxt = useNuxt()
const nuxt = useNuxt() as Nuxt & { _nitro?: Nitro }

// Ensure we're not just building with 'static' target
if (!nuxt.options.dev && nuxt.options.target === 'static' && !nuxt.options._prepare && !nuxt.options._generate && !(nuxt.options as any)._export && !nuxt.options._legacyGenerate) {
Expand Down Expand Up @@ -154,7 +154,8 @@ export async function setupNitroBridge () {
// Initiate nitro
const nitro = await createNitro(nitroConfig)

// Expose nitro to modules
// Expose nitro to modules and kit
nuxt._nitro = nitro
await nuxt.callHook('nitro:init', nitro)

// Shared vfs storage
Expand Down

0 comments on commit 378ce3d

Please sign in to comment.