mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-08 01:42:38 +00:00
90784f79d7
* docs: implement new website theme * chore: rename dirs * chore: update build * lint fix * chore: update deps * fix: include node_modules in esbuild step * chore: update deps * Update .gitignore * chore: update theme version * up * up * fix: use svg for illustration * chore: update to 0.0.12 * chore: force parse5 resolution * stay with build * feat: always display first home section * Update yarn.lock * chore: update theme * fix lint * docs: update home title * chore: update website theme version * Update docs/content/0.index.md Co-authored-by: pooya parsa <pyapar@gmail.com> * Update docs/content/0.index.md Co-authored-by: pooya parsa <pyapar@gmail.com> * up * chore: bump theme version * up * chore: up * up up and up * chore: generate * fix: boolean value * feat: new images * update again * chore: up * ouep * chore: up Co-authored-by: Daniel Roe <daniel@roe.dev> Co-authored-by: Clément Ollivier <clement.o2p@gmail.com> Co-authored-by: pooya parsa <pyapar@gmail.com>
47 lines
1.4 KiB
Markdown
47 lines
1.4 KiB
Markdown
---
|
|
title: "Nuxt Kit"
|
|
description: "@nuxt/kit provides features for module authors."
|
|
---
|
|
|
|
# Nuxt Kit
|
|
|
|
> Nuxt Kit provides composable utilities to make interacting with [Nuxt Hooks](/docs/api/advanced/hooks) and [Nuxt Builder Core](/docs/guide/going-further/internals#the-nuxt-interface) and developing [Nuxt Modules](/docs/guide/going-further/modules) super easy!
|
|
|
|
## Usage
|
|
|
|
### Install Dependency
|
|
|
|
You can install the latest Nuxt Kit by adding it to the `dependencies` section of your `package.json`. However, please consider always explicitly installing the `@nuxt/kit` package even if it is already installed by Nuxt.
|
|
|
|
```json [package.json]
|
|
{
|
|
"dependencies": {
|
|
"@nuxt/kit": "npm:@nuxt/kit-edge@latest"
|
|
}
|
|
}
|
|
```
|
|
|
|
### Import Kit Utilities
|
|
|
|
```js [test.mjs]
|
|
import { useNuxt } from '@nuxt/kit'
|
|
```
|
|
|
|
::ReadMore{link="/docs/api/advanced/kit" title="API > Advanced > Kit"}
|
|
::
|
|
|
|
::alert{type="warning"}
|
|
Nuxt Kit utilities are only available for modules and not meant to be imported in runtime (components, Vue composables, pages, plugins, or server routes).
|
|
::
|
|
|
|
Nuxt Kit is an [esm-only package](/docs/guide/going-further/esm) meaning that you **cannot** `require('@nuxt/kit')`. As a workaround, use dynamic import in the CommonJS context:
|
|
|
|
```js [test.cjs]
|
|
// This does NOT work!
|
|
// const kit = require('@nuxt/kit')
|
|
async function main() {
|
|
const kit = await import('@nuxt/kit')
|
|
}
|
|
main()
|
|
```
|