Kit Utilities

Utilities

Modules

source code

  • installModule(module, inlineOptions)

Programmatic Usage

source code

  • loadNuxt(loadOptions)
  • buildNuxt(nuxt)
  • loadNuxtConfig(loadOptions)

Compatibility

source code

  • checkNuxtCompatibility(constraints)
  • assertNuxtCompatibility(constraints)
  • hasNuxtCompatibility(constraints)
  • isNuxt2()
  • isNuxt3()
  • getNuxtVersion()

Auto-imports

source code

  • addImports(imports)
  • addImportsDir(importDirs, { prepend? })
  • addImportsSources(importSources)

Components

source code

  • addComponentsDir(dir)
  • addComponent(componentObject)

Context

source code

  • useNuxt()

Pages

source code

  • extendPages (callback: pages => void)
  • extendRouteRules (route: string, rule: NitroRouteConfig, options: ExtendRouteRulesOptions)
  • addRouteMiddleware (input: NuxtMiddleware | NuxtMiddleware[], options: AddRouteMiddlewareOptions)

Plugins

source code

  • addPlugin(pluginOptions, { append? })
  • addPluginTemplate(pluginOptions, { append? })

Templates

source code

  • addTemplate(templateOptions)
  • addTypeTemplate(templateOptions)
  • updateTemplates({ filter?: ResolvedNuxtTemplate => boolean })

Nitro

source code

  • addServerHandler (handler)
  • addDevServerHandler (handler)
  • useNitro() (only usable after ready hook)
  • addServerPlugin
  • addPrerenderRoutes

Resolving

source code

  • resolvePath (path, resolveOptions?)
  • resolveAlias (path, aliases?)
  • findPath (paths, resolveOptions?)
  • createResolver (base)

Logging

source code

  • useLogger(scope?)

Builder

source code

  • extendWebpackConfig(callback, options?)
  • extendViteConfig(callback, options?)
  • addWebpackPlugin(webpackPlugin, options?)
  • addVitePlugin(vitePlugin, options?)