Plugins

To extend nitro's runtime behavior, we can register plugins.


They will be synchronously on the first nitro initialization given nitroApp context, which can be used to hook into lifecycle events.

Example: Simple plugin

// plugins/test.tsexport default defineNitroPlugin((nitroApp) => {  console.log('Nitro plugin', nitroApp)})
// nitro.config.tsimport { defineNitroConfig } from 'nitropack'export default defineNitroConfig({  plugins: [    '~/plugins/test'  ]})