feat(kit): add addServerPlugin utility (#8635)

This commit is contained in:
Daniel Roe 2022-11-03 10:54:05 -04:00 committed by GitHub
parent 71ecffa234
commit e450debc08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
*