diff --git a/packages/kit/src/nitro.ts b/packages/kit/src/nitro.ts index 3222f6be70..d28923280b 100644 --- a/packages/kit/src/nitro.ts +++ b/packages/kit/src/nitro.ts @@ -32,6 +32,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 || [] + nuxt.options.nitro.plugins.push(normalize(plugin)) +} + /** * Access to the Nitro instance *