Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/kit/src/nitro.ts
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
import type { NitroEventHandler, NitroDevEventHandler, Nitro } from 'nitropack'
import { normalize } from 'pathe'
import { useNuxt } from './context'

/**
Expand DownExpand Up@@ -30,6 +31,15 @@ export function addDevServerHandler (handler: NitroDevEventHandler) {
useNuxt().options.devServerHandlers.push(handler)
}

/**
* Adds a Nitro plugin
*/
export function addServerPlugin (plugin: string) {
const nuxt = useNuxt()
nuxt.options.nitro.plugins = nuxt.options.nitro.plugins || []
Comment thread
pi0 marked this conversation as resolved.
nuxt.options.nitro.plugins.push(normalize(plugin))
}

/**
* Access to the Nitro instance
*
Expand Down