Skip to content

Commit 378ce3d

Browse files
committed
fix: expose nitro instance via kit useNitro
1 parent 4585eb0 commit 378ce3d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/nitro.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { distDir } from './dirs'
1616
import { isDirectory, readDirRecursively } from './vite/utils/fs'
1717

1818
export async function setupNitroBridge () {
19-
const nuxt = useNuxt()
19+
const nuxt = useNuxt() as Nuxt & { _nitro?: Nitro }
2020

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

157-
// Expose nitro to modules
157+
// Expose nitro to modules and kit
158+
nuxt._nitro = nitro
158159
await nuxt.callHook('nitro:init', nitro)
159160

160161
// Shared vfs storage

0 commit comments

Comments
 (0)