@nuxt/docs-nightly 4.3.0-29356103.2f7957ac → 4.3.0-29430616.754c35a4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/1.getting-started/01.introduction.md +1 -1
- package/1.getting-started/02.installation.md +4 -6
- package/1.getting-started/03.configuration.md +27 -27
- package/1.getting-started/04.views.md +5 -5
- package/1.getting-started/05.assets.md +8 -8
- package/1.getting-started/06.styling.md +15 -15
- package/1.getting-started/07.routing.md +10 -6
- package/1.getting-started/08.seo-meta.md +3 -3
- package/1.getting-started/09.transitions.md +10 -10
- package/1.getting-started/10.data-fetching.md +16 -16
- package/1.getting-started/11.state-management.md +3 -3
- package/1.getting-started/12.error-handling.md +6 -6
- package/1.getting-started/13.server.md +6 -6
- package/1.getting-started/14.layers.md +32 -13
- package/1.getting-started/16.deployment.md +1 -1
- package/1.getting-started/17.testing.md +36 -5
- package/1.getting-started/18.upgrade.md +43 -35
- package/{2.guide/1.directory-structure → 2.directory-structure}/0.nuxt.md +1 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/0.output.md +1 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.assets.md +2 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.components.md +6 -6
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.composables.md +2 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.layouts.md +3 -3
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.middleware.md +5 -5
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.pages.md +17 -17
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.plugins.md +3 -7
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.utils.md +3 -3
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/3.app.md +4 -4
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/3.error.md +1 -3
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.content.md +2 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.modules.md +2 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.node_modules.md +2 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.public.md +1 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.server.md +7 -7
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.shared.md +3 -3
- package/{2.guide/1.directory-structure → 2.directory-structure}/2.env.md +2 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/2.nuxtignore.md +1 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/2.nuxtrc.md +1 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/3.nuxt-config.md +1 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/3.package.md +1 -1
- package/2.directory-structure/3.tsconfig.md +69 -0
- package/2.directory-structure/index.md +61 -0
- package/{2.guide → 3.guide}/0.index.md +10 -7
- package/{2.guide/2.concepts/3.rendering.md → 3.guide/1.concepts/1.rendering.md} +4 -30
- package/{2.guide/2.concepts/2.vuejs-development.md → 3.guide/1.concepts/10.vuejs-development.md} +7 -6
- package/{2.guide/2.concepts/10.nuxt-lifecycle.md → 3.guide/1.concepts/2.nuxt-lifecycle.md} +32 -25
- package/{2.guide/2.concepts/1.auto-imports.md → 3.guide/1.concepts/3.auto-imports.md} +7 -7
- package/{2.guide/2.concepts → 3.guide/1.concepts}/4.server-engine.md +3 -3
- package/{2.guide/2.concepts → 3.guide/1.concepts}/5.modules.md +2 -2
- package/{2.guide/2.concepts → 3.guide/1.concepts}/7.esm.md +3 -2
- package/{2.guide/2.concepts → 3.guide/1.concepts}/8.typescript.md +15 -38
- package/{2.guide/2.concepts → 3.guide/1.concepts}/9.code-style.md +1 -1
- package/{2.guide/5.best-practices → 3.guide/2.best-practices}/hydration.md +1 -1
- package/{2.guide/5.best-practices → 3.guide/2.best-practices}/performance.md +2 -2
- package/3.guide/3.ai/.navigation.yml +3 -0
- package/3.guide/3.ai/1.mcp.md +255 -0
- package/3.guide/3.ai/2.llms-txt.md +65 -0
- package/3.guide/4.modules/.navigation.yml +3 -0
- package/3.guide/4.modules/1.getting-started.md +103 -0
- package/3.guide/4.modules/2.module-anatomy.md +138 -0
- package/3.guide/4.modules/3.recipes-basics.md +299 -0
- package/3.guide/4.modules/4.recipes-advanced.md +231 -0
- package/3.guide/4.modules/5.testing.md +76 -0
- package/3.guide/4.modules/6.best-practices.md +104 -0
- package/3.guide/4.modules/7.ecosystem.md +32 -0
- package/3.guide/4.modules/index.md +36 -0
- package/{2.guide/4.recipes → 3.guide/5.recipes}/1.custom-routing.md +5 -5
- package/{2.guide/4.recipes → 3.guide/5.recipes}/2.vite-plugin.md +1 -1
- package/{2.guide/4.recipes → 3.guide/5.recipes}/3.custom-usefetch.md +1 -1
- package/{2.guide/4.recipes → 3.guide/5.recipes}/4.sessions-and-authentication.md +1 -1
- package/{2.guide/3.going-further → 3.guide/6.going-further}/1.events.md +2 -3
- package/{2.guide/3.going-further → 3.guide/6.going-further}/1.experimental-features.md +10 -10
- package/{2.guide/3.going-further → 3.guide/6.going-further}/1.features.md +1 -1
- package/{2.guide/3.going-further → 3.guide/6.going-further}/1.internals.md +5 -4
- package/{2.guide/3.going-further → 3.guide/6.going-further}/10.runtime-config.md +2 -2
- package/{2.guide/3.going-further → 3.guide/6.going-further}/2.hooks.md +3 -3
- package/{2.guide/3.going-further → 3.guide/6.going-further}/4.kit.md +1 -1
- package/{2.guide/3.going-further → 3.guide/6.going-further}/6.nuxt-app.md +5 -5
- package/{2.guide/3.going-further → 3.guide/6.going-further}/7.layers.md +42 -25
- package/{2.guide/3.going-further → 3.guide/6.going-further}/9.debugging.md +1 -1
- package/{3.api → 4.api}/1.components/10.nuxt-picture.md +1 -1
- package/{3.api → 4.api}/1.components/11.teleports.md +1 -1
- package/{3.api → 4.api}/1.components/12.nuxt-route-announcer.md +1 -3
- package/{3.api → 4.api}/1.components/13.nuxt-time.md +0 -2
- package/{3.api → 4.api}/1.components/2.nuxt-page.md +3 -3
- package/{3.api → 4.api}/1.components/3.nuxt-layout.md +5 -5
- package/{3.api → 4.api}/1.components/4.nuxt-link.md +11 -11
- package/{3.api → 4.api}/1.components/5.nuxt-loading-indicator.md +1 -1
- package/{3.api → 4.api}/1.components/6.nuxt-error-boundary.md +1 -1
- package/{3.api → 4.api}/1.components/7.nuxt-welcome.md +2 -2
- package/{3.api → 4.api}/2.composables/use-app-config.md +1 -1
- package/{3.api → 4.api}/2.composables/use-async-data.md +76 -13
- package/4.api/2.composables/use-cookie.md +183 -0
- package/{3.api → 4.api}/2.composables/use-fetch.md +33 -33
- package/{3.api → 4.api}/2.composables/use-head-safe.md +37 -20
- package/4.api/2.composables/use-head.md +184 -0
- package/{3.api → 4.api}/2.composables/use-hydration.md +24 -18
- package/4.api/2.composables/use-lazy-async-data.md +96 -0
- package/4.api/2.composables/use-lazy-fetch.md +111 -0
- package/{3.api → 4.api}/2.composables/use-nuxt-app.md +7 -7
- package/{3.api → 4.api}/2.composables/use-nuxt-data.md +1 -1
- package/{3.api → 4.api}/2.composables/use-request-fetch.md +1 -1
- package/{3.api → 4.api}/2.composables/use-response-header.md +1 -1
- package/{3.api → 4.api}/2.composables/use-route-announcer.md +0 -2
- package/{3.api → 4.api}/2.composables/use-route.md +2 -2
- package/4.api/2.composables/use-router.md +94 -0
- package/{3.api → 4.api}/2.composables/use-runtime-config.md +1 -1
- package/{3.api → 4.api}/2.composables/use-runtime-hook.md +1 -1
- package/{3.api → 4.api}/2.composables/use-state.md +1 -1
- package/{3.api → 4.api}/3.utils/$fetch.md +1 -1
- package/{3.api → 4.api}/3.utils/abort-navigation.md +3 -3
- package/{3.api → 4.api}/3.utils/add-route-middleware.md +1 -1
- package/{3.api → 4.api}/3.utils/call-once.md +0 -2
- package/{3.api → 4.api}/3.utils/define-lazy-hydration-component.md +4 -4
- package/{3.api → 4.api}/3.utils/define-nuxt-component.md +1 -1
- package/4.api/3.utils/define-nuxt-plugin.md +102 -0
- package/{3.api → 4.api}/3.utils/define-nuxt-route-middleware.md +2 -2
- package/{3.api → 4.api}/3.utils/define-page-meta.md +14 -14
- package/{3.api → 4.api}/3.utils/navigate-to.md +15 -15
- package/{3.api → 4.api}/3.utils/on-before-route-leave.md +1 -1
- package/{3.api → 4.api}/3.utils/on-before-route-update.md +1 -1
- package/{3.api → 4.api}/3.utils/refresh-cookie.md +1 -3
- package/{3.api → 4.api}/3.utils/update-app-config.md +2 -2
- package/{3.api → 4.api}/4.commands/add.md +11 -11
- package/4.api/4.commands/analyze.md +42 -0
- package/4.api/4.commands/build-module.md +42 -0
- package/4.api/4.commands/build.md +47 -0
- package/{3.api → 4.api}/4.commands/cleanup.md +6 -6
- package/4.api/4.commands/dev.md +60 -0
- package/{3.api → 4.api}/4.commands/devtools.md +7 -7
- package/4.api/4.commands/generate.md +42 -0
- package/4.api/4.commands/info.md +33 -0
- package/4.api/4.commands/init.md +50 -0
- package/4.api/4.commands/module.md +84 -0
- package/4.api/4.commands/prepare.md +41 -0
- package/4.api/4.commands/preview.md +44 -0
- package/4.api/4.commands/test.md +40 -0
- package/4.api/4.commands/typecheck.md +44 -0
- package/4.api/4.commands/upgrade.md +37 -0
- package/{3.api → 4.api}/5.kit/1.modules.md +18 -18
- package/{3.api → 4.api}/5.kit/10.templates.md +23 -23
- package/{3.api → 4.api}/5.kit/11.nitro.md +35 -35
- package/{3.api → 4.api}/5.kit/14.builder.md +21 -21
- package/{3.api → 4.api}/5.kit/16.layers.md +12 -12
- package/{3.api → 4.api}/5.kit/2.programmatic.md +2 -2
- package/{3.api → 4.api}/5.kit/4.autoimports.md +18 -18
- package/4.api/5.kit/5.components.md +146 -0
- package/4.api/6.advanced/1.hooks.md +105 -0
- package/{3.api → 4.api}/6.nuxt-config.md +29 -28
- package/5.community/3.reporting-bugs.md +1 -1
- package/5.community/4.contribution.md +4 -4
- package/5.community/5.framework-contribution.md +8 -8
- package/5.community/6.roadmap.md +25 -25
- package/5.community/7.changelog.md +10 -0
- package/6.bridge/1.overview.md +1 -1
- package/6.bridge/2.typescript.md +1 -1
- package/6.bridge/3.bridge-composition-api.md +1 -1
- package/6.bridge/4.plugins-and-middleware.md +2 -2
- package/7.migration/11.server.md +1 -1
- package/7.migration/2.configuration.md +5 -5
- package/7.migration/20.module-authors.md +3 -3
- package/7.migration/3.auto-imports.md +1 -1
- package/7.migration/5.plugins-and-middleware.md +2 -2
- package/7.migration/6.pages-and-layouts.md +6 -6
- package/README.md +1 -1
- package/package.json +1 -1
- package/2.guide/1.directory-structure/3.tsconfig.md +0 -38
- package/2.guide/3.going-further/3.modules.md +0 -901
- package/3.api/2.composables/use-cookie.md +0 -183
- package/3.api/2.composables/use-head.md +0 -69
- package/3.api/2.composables/use-lazy-async-data.md +0 -47
- package/3.api/2.composables/use-lazy-fetch.md +0 -55
- package/3.api/2.composables/use-router.md +0 -94
- package/3.api/3.utils/define-nuxt-plugin.md +0 -102
- package/3.api/4.commands/analyze.md +0 -42
- package/3.api/4.commands/build-module.md +0 -42
- package/3.api/4.commands/build.md +0 -47
- package/3.api/4.commands/dev.md +0 -60
- package/3.api/4.commands/generate.md +0 -42
- package/3.api/4.commands/info.md +0 -33
- package/3.api/4.commands/init.md +0 -50
- package/3.api/4.commands/module.md +0 -84
- package/3.api/4.commands/prepare.md +0 -41
- package/3.api/4.commands/preview.md +0 -44
- package/3.api/4.commands/test.md +0 -40
- package/3.api/4.commands/typecheck.md +0 -44
- package/3.api/4.commands/upgrade.md +0 -37
- package/3.api/5.kit/5.components.md +0 -146
- package/3.api/6.advanced/1.hooks.md +0 -105
- /package/{2.guide/1.directory-structure → 2.directory-structure}/.navigation.yml +0 -0
- /package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/.navigation.yml +0 -0
- /package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/3.app-config.md +0 -0
- /package/{2.guide/1.directory-structure → 2.directory-structure}/2.gitignore.md +0 -0
- /package/{2.guide → 3.guide}/.navigation.yml +0 -0
- /package/{2.guide/2.concepts → 3.guide/1.concepts}/.navigation.yml +0 -0
- /package/{2.guide/5.best-practices → 3.guide/2.best-practices}/.navigation.yml +0 -0
- /package/{2.guide/5.best-practices → 3.guide/2.best-practices}/plugins.md +0 -0
- /package/{2.guide/4.recipes → 3.guide/5.recipes}/.navigation.yml +0 -0
- /package/{2.guide/3.going-further → 3.guide/6.going-further}/.navigation.yml +0 -0
- /package/{2.guide/3.going-further → 3.guide/6.going-further}/11.nightly-release-channel.md +0 -0
- /package/{2.guide/3.going-further → 3.guide/6.going-further}/index.md +0 -0
- /package/{3.api → 4.api}/.navigation.yml +0 -0
- /package/{3.api → 4.api}/1.components/.navigation.yml +0 -0
- /package/{3.api → 4.api}/1.components/1.client-only.md +0 -0
- /package/{3.api → 4.api}/1.components/1.dev-only.md +0 -0
- /package/{3.api → 4.api}/1.components/1.nuxt-client-fallback.md +0 -0
- /package/{3.api → 4.api}/1.components/8.nuxt-island.md +0 -0
- /package/{3.api → 4.api}/1.components/9.nuxt-img.md +0 -0
- /package/{3.api → 4.api}/2.composables/.navigation.yml +0 -0
- /package/{3.api → 4.api}/2.composables/on-prehydrate.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-error.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-loading-indicator.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-preview-mode.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-request-event.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-request-header.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-request-headers.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-request-url.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-seo-meta.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-server-seo-meta.md +0 -0
- /package/{3.api → 4.api}/3.utils/.navigation.yml +0 -0
- /package/{3.api → 4.api}/3.utils/clear-error.md +0 -0
- /package/{3.api → 4.api}/3.utils/clear-nuxt-data.md +0 -0
- /package/{3.api → 4.api}/3.utils/clear-nuxt-state.md +0 -0
- /package/{3.api → 4.api}/3.utils/create-error.md +0 -0
- /package/{3.api → 4.api}/3.utils/define-route-rules.md +0 -0
- /package/{3.api → 4.api}/3.utils/on-nuxt-ready.md +0 -0
- /package/{3.api → 4.api}/3.utils/prefetch-components.md +0 -0
- /package/{3.api → 4.api}/3.utils/preload-components.md +0 -0
- /package/{3.api → 4.api}/3.utils/preload-route-components.md +0 -0
- /package/{3.api → 4.api}/3.utils/prerender-routes.md +0 -0
- /package/{3.api → 4.api}/3.utils/refresh-nuxt-data.md +0 -0
- /package/{3.api → 4.api}/3.utils/reload-nuxt-app.md +0 -0
- /package/{3.api → 4.api}/3.utils/set-page-layout.md +0 -0
- /package/{3.api → 4.api}/3.utils/set-response-status.md +0 -0
- /package/{3.api → 4.api}/3.utils/show-error.md +0 -0
- /package/{3.api → 4.api}/4.commands/.navigation.yml +0 -0
- /package/{3.api → 4.api}/5.kit/.navigation.yml +0 -0
- /package/{3.api → 4.api}/5.kit/10.runtime-config.md +0 -0
- /package/{3.api → 4.api}/5.kit/12.resolving.md +0 -0
- /package/{3.api → 4.api}/5.kit/13.logging.md +0 -0
- /package/{3.api → 4.api}/5.kit/15.examples.md +0 -0
- /package/{3.api → 4.api}/5.kit/3.compatibility.md +0 -0
- /package/{3.api → 4.api}/5.kit/6.context.md +0 -0
- /package/{3.api → 4.api}/5.kit/7.pages.md +0 -0
- /package/{3.api → 4.api}/5.kit/8.layout.md +0 -0
- /package/{3.api → 4.api}/5.kit/9.head.md +0 -0
- /package/{3.api → 4.api}/5.kit/9.plugins.md +0 -0
- /package/{3.api → 4.api}/6.advanced/.navigation.yml +0 -0
- /package/{3.api → 4.api}/6.advanced/2.import-meta.md +0 -0
- /package/{3.api → 4.api}/index.md +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "nuxt test"
|
|
3
|
+
description: The test command runs tests using @nuxt/test-utils.
|
|
4
|
+
links:
|
|
5
|
+
- label: Source
|
|
6
|
+
icon: i-simple-icons-github
|
|
7
|
+
to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/test.ts
|
|
8
|
+
size: xs
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<!--test-cmd-->
|
|
12
|
+
```bash [Terminal]
|
|
13
|
+
npx nuxt test [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--dev] [--watch]
|
|
14
|
+
```
|
|
15
|
+
<!--/test-cmd-->
|
|
16
|
+
|
|
17
|
+
The `test` command runs tests using [`@nuxt/test-utils`](/docs/getting-started/testing). This command sets `process.env.NODE_ENV` to `test` if not already set.
|
|
18
|
+
|
|
19
|
+
## Arguments
|
|
20
|
+
|
|
21
|
+
<!--test-args-->
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
25
|
+
<!--/test-args-->
|
|
26
|
+
|
|
27
|
+
## Options
|
|
28
|
+
|
|
29
|
+
<!--test-opts-->
|
|
30
|
+
| Option | Default | Description |
|
|
31
|
+
|--------------------------------------|---------|----------------------------------------------------------------------------------|
|
|
32
|
+
| `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
|
|
33
|
+
| `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level |
|
|
34
|
+
| `--dev` | | Run in dev mode |
|
|
35
|
+
| `--watch` | | Watch mode |
|
|
36
|
+
<!--/test-opts-->
|
|
37
|
+
|
|
38
|
+
::note
|
|
39
|
+
This command sets `process.env.NODE_ENV` to `test`.
|
|
40
|
+
::
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "nuxt typecheck"
|
|
3
|
+
description: The typecheck command runs vue-tsc to check types throughout your app.
|
|
4
|
+
links:
|
|
5
|
+
- label: Source
|
|
6
|
+
icon: i-simple-icons-github
|
|
7
|
+
to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/typecheck.ts
|
|
8
|
+
size: xs
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<!--typecheck-cmd-->
|
|
12
|
+
```bash [Terminal]
|
|
13
|
+
npx nuxt typecheck [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--dotenv] [-e, --extends=<layer-name>]
|
|
14
|
+
```
|
|
15
|
+
<!--/typecheck-cmd-->
|
|
16
|
+
|
|
17
|
+
The `typecheck` command runs [`vue-tsc`](https://github.com/vuejs/language-tools/tree/master/packages/tsc) to check types throughout your app.
|
|
18
|
+
|
|
19
|
+
## Arguments
|
|
20
|
+
|
|
21
|
+
<!--typecheck-args-->
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
25
|
+
<!--/typecheck-args-->
|
|
26
|
+
|
|
27
|
+
## Options
|
|
28
|
+
|
|
29
|
+
<!--typecheck-opts-->
|
|
30
|
+
| Option | Default | Description |
|
|
31
|
+
|--------------------------------------|---------|----------------------------------------------------------------------------------|
|
|
32
|
+
| `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
|
|
33
|
+
| `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level |
|
|
34
|
+
| `--dotenv` | | Path to `.env` file to load, relative to the root directory |
|
|
35
|
+
| `-e, --extends=<layer-name>` | | Extend from a Nuxt layer |
|
|
36
|
+
<!--/typecheck-opts-->
|
|
37
|
+
|
|
38
|
+
::note
|
|
39
|
+
This command sets `process.env.NODE_ENV` to `production`. To override, define `NODE_ENV` in a [`.env`](/docs/4.x/directory-structure/env) file or as a command-line argument.
|
|
40
|
+
::
|
|
41
|
+
|
|
42
|
+
::read-more{to="/docs/4.x/guide/concepts/typescript#type-checking"}
|
|
43
|
+
Read more on how to enable type-checking at build or development time.
|
|
44
|
+
::
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "nuxt upgrade"
|
|
3
|
+
description: The upgrade command upgrades Nuxt to the latest version.
|
|
4
|
+
links:
|
|
5
|
+
- label: Source
|
|
6
|
+
icon: i-simple-icons-github
|
|
7
|
+
to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/upgrade.ts
|
|
8
|
+
size: xs
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<!--upgrade-cmd-->
|
|
12
|
+
```bash [Terminal]
|
|
13
|
+
npx nuxt upgrade [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--dedupe] [-f, --force] [-ch, --channel=<stable|nightly|v3|v4|v4-nightly|v3-nightly>]
|
|
14
|
+
```
|
|
15
|
+
<!--/upgrade-cmd-->
|
|
16
|
+
|
|
17
|
+
The `upgrade` command upgrades Nuxt to the latest version.
|
|
18
|
+
|
|
19
|
+
## Arguments
|
|
20
|
+
|
|
21
|
+
<!--upgrade-args-->
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
25
|
+
<!--/upgrade-args-->
|
|
26
|
+
|
|
27
|
+
## Options
|
|
28
|
+
|
|
29
|
+
<!--upgrade-opts-->
|
|
30
|
+
| Option | Default | Description |
|
|
31
|
+
|--------------------------------------------------------------------|----------|----------------------------------------------------------------------------------|
|
|
32
|
+
| `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
|
|
33
|
+
| `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level |
|
|
34
|
+
| `--dedupe` | | Dedupe dependencies after upgrading |
|
|
35
|
+
| `-f, --force` | | Force upgrade to recreate lockfile and node_modules |
|
|
36
|
+
| `-ch, --channel=<stable\|nightly\|v3\|v4\|v4-nightly\|v3-nightly>` | `stable` | Specify a channel to install from (default: stable) |
|
|
37
|
+
<!--/upgrade-opts-->
|
|
@@ -4,7 +4,7 @@ description: Nuxt Kit provides a set of utilities to help you create and use mod
|
|
|
4
4
|
links:
|
|
5
5
|
- label: Source
|
|
6
6
|
icon: i-simple-icons-github
|
|
7
|
-
to: https://github.com/nuxt/nuxt/
|
|
7
|
+
to: https://github.com/nuxt/nuxt/tree/main/packages/kit/src/module
|
|
8
8
|
size: xs
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -47,7 +47,7 @@ export function defineNuxtModule<TOptions extends ModuleOptions> (
|
|
|
47
47
|
|
|
48
48
|
export function defineNuxtModule<TOptions extends ModuleOptions> (): {
|
|
49
49
|
with: <TOptionsDefaults extends Partial<TOptions>> (
|
|
50
|
-
definition: ModuleDefinition<TOptions, TOptionsDefaults, true> | NuxtModule<TOptions, TOptionsDefaults, true
|
|
50
|
+
definition: ModuleDefinition<TOptions, TOptionsDefaults, true> | NuxtModule<TOptions, TOptionsDefaults, true>,
|
|
51
51
|
) => NuxtModule<TOptions, TOptionsDefaults, true>
|
|
52
52
|
}
|
|
53
53
|
```
|
|
@@ -56,16 +56,16 @@ export function defineNuxtModule<TOptions extends ModuleOptions> (): {
|
|
|
56
56
|
|
|
57
57
|
**definition**: A module definition object or a module function. The module definition object should contain the following properties:
|
|
58
58
|
|
|
59
|
-
| Property
|
|
60
|
-
|
|
61
|
-
| `meta`
|
|
62
|
-
| `defaults`
|
|
63
|
-
| `schema`
|
|
64
|
-
| `hooks`
|
|
65
|
-
| `moduleDependencies` | `Record<string, ModuleDependency> \| ((nuxt: Nuxt) => Record<string, ModuleDependency>)`{lang="ts"}
|
|
66
|
-
| `onInstall`
|
|
67
|
-
| `onUpgrade`
|
|
68
|
-
| `setup`
|
|
59
|
+
| Property | Type | Required | Description |
|
|
60
|
+
|----------------------|-------------------------------------------------------------------------------------------------------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
61
|
+
| `meta` | `ModuleMeta` | `false` | Metadata of the module. It defines the module name, version, config key and compatibility. |
|
|
62
|
+
| `defaults` | `T \| ((nuxt: Nuxt) => T)`{lang="ts"} | `false` | Default options for the module. If a function is provided, it will be called with the Nuxt instance as the first argument. |
|
|
63
|
+
| `schema` | `T` | `false` | Schema for the module options. If provided, options will be applied to the schema. |
|
|
64
|
+
| `hooks` | `Partial<NuxtHooks>`{lang="ts"} | `false` | Hooks to be installed for the module. If provided, the module will install the hooks. |
|
|
65
|
+
| `moduleDependencies` | `Record<string, ModuleDependency> \| ((nuxt: Nuxt) => Record<string, ModuleDependency>)`{lang="ts"} | `false` | Dependencies on other modules with version constraints and configuration. Can be an object or a function that receives the Nuxt instance. See [example](/docs/4.x/api/kit/modules#specifying-module-dependencies). |
|
|
66
|
+
| `onInstall` | `(nuxt: Nuxt) => Awaitable<void>`{lang="ts"} | `false` | Lifecycle hook called when the module is first installed. Requires `meta.name` and `meta.version` to be defined. |
|
|
67
|
+
| `onUpgrade` | `(options: T, nuxt: Nuxt, previousVersion: string) => Awaitable<void>`{lang="ts"} | `false` | Lifecycle hook called when the module is upgraded to a newer version. Requires `meta.name` and `meta.version` to be defined. |
|
|
68
|
+
| `setup` | `(this: void, resolvedOptions: T, nuxt: Nuxt) => Awaitable<void \| false \| ModuleSetupInstallResult>`{lang="ts"} | `false` | Setup function for the module. If provided, the module will call the setup function. |
|
|
69
69
|
|
|
70
70
|
### Examples
|
|
71
71
|
|
|
@@ -324,7 +324,7 @@ export default defineNuxtModule({
|
|
|
324
324
|
## `installModule`
|
|
325
325
|
|
|
326
326
|
::callout{type="warning"}
|
|
327
|
-
**Deprecated:** Use the [`moduleDependencies`](#specifying-module-dependencies) option in `defineNuxtModule` instead. The `installModule` function will be removed (or may become non-blocking) in a future version.
|
|
327
|
+
**Deprecated:** Use the [`moduleDependencies`](/docs/4.x/api/kit/modules#specifying-module-dependencies) option in `defineNuxtModule` instead. The `installModule` function will be removed (or may become non-blocking) in a future version.
|
|
328
328
|
::
|
|
329
329
|
|
|
330
330
|
Install specified Nuxt module programmatically. This is helpful when your module depends on other modules. You can pass the module options as an object to `inlineOptions` and they will be passed to the module's `setup` function.
|
|
@@ -359,11 +359,11 @@ async function installModule (moduleToInstall: string | NuxtModule, inlineOption
|
|
|
359
359
|
|
|
360
360
|
### Parameters
|
|
361
361
|
|
|
362
|
-
| Property
|
|
363
|
-
|
|
364
|
-
| `moduleToInstall`
|
|
365
|
-
| `inlineOptions`
|
|
366
|
-
| `nuxt`
|
|
362
|
+
| Property | Type | Required | Description |
|
|
363
|
+
|-------------------|-----------------------------------|----------|-----------------------------------------------------------------------------------------------|
|
|
364
|
+
| `moduleToInstall` | `string \| NuxtModule`{lang="ts"} | `true` | The module to install. Can be either a string with the module name or a module object itself. |
|
|
365
|
+
| `inlineOptions` | `any` | `false` | An object with the module options to be passed to the module's `setup` function. |
|
|
366
|
+
| `nuxt` | `Nuxt` | `false` | Nuxt instance. If not provided, it will be retrieved from the context via `useNuxt()` call. |
|
|
367
367
|
|
|
368
368
|
### Examples
|
|
369
369
|
|
|
@@ -48,14 +48,14 @@ function addTemplate (template: NuxtTemplate | string): ResolvedNuxtTemplate
|
|
|
48
48
|
|
|
49
49
|
**template**: A template object or a string with the path to the template. If a string is provided, it will be converted to a template object with `src` set to the string value. If a template object is provided, it must have the following properties:
|
|
50
50
|
|
|
51
|
-
| Property
|
|
52
|
-
|
|
53
|
-
| `src`
|
|
54
|
-
| `filename`
|
|
55
|
-
| `dst`
|
|
56
|
-
| `options`
|
|
51
|
+
| Property | Type | Required | Description |
|
|
52
|
+
|---------------|-----------------------------------------------------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
53
|
+
| `src` | `string` | `false` | Path to the template. If `src` is not provided, `getContents` must be provided instead. |
|
|
54
|
+
| `filename` | `string` | `false` | Filename of the template. If `filename` is not provided, it will be generated from the `src` path. In this case, the `src` option is required. |
|
|
55
|
+
| `dst` | `string` | `false` | Path to the destination file. If `dst` is not provided, it will be generated from the `filename` path and nuxt `buildDir` option. |
|
|
56
|
+
| `options` | `Options` | `false` | Options to pass to the template. |
|
|
57
57
|
| `getContents` | `(data: Options) => string \| Promise<string>`{lang="ts"} | `false` | A function that will be called with the `options` object. It should return a string or a promise that resolves to a string. If `src` is provided, this function will be ignored. |
|
|
58
|
-
| `write`
|
|
58
|
+
| `write` | `boolean` | `false` | If set to `true`, the template will be written to the destination file. Otherwise, the template will be used only in virtual filesystem. |
|
|
59
59
|
|
|
60
60
|
### Examples
|
|
61
61
|
|
|
@@ -133,20 +133,20 @@ function addTypeTemplate (template: NuxtTypeTemplate | string, context?: { nitro
|
|
|
133
133
|
|
|
134
134
|
**template**: A template object or a string with the path to the template. If a string is provided, it will be converted to a template object with `src` set to the string value. If a template object is provided, it must have the following properties:
|
|
135
135
|
|
|
136
|
-
| Property
|
|
137
|
-
|
|
138
|
-
| `src`
|
|
139
|
-
| `filename`
|
|
140
|
-
| `dst`
|
|
141
|
-
| `options`
|
|
136
|
+
| Property | Type | Required | Description |
|
|
137
|
+
|---------------|-----------------------------------------------------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
138
|
+
| `src` | `string` | `false` | Path to the template. If `src` is not provided, `getContents` must be provided instead. |
|
|
139
|
+
| `filename` | `string` | `false` | Filename of the template. If `filename` is not provided, it will be generated from the `src` path. In this case, the `src` option is required. |
|
|
140
|
+
| `dst` | `string` | `false` | Path to the destination file. If `dst` is not provided, it will be generated from the `filename` path and nuxt `buildDir` option. |
|
|
141
|
+
| `options` | `Options` | `false` | Options to pass to the template. |
|
|
142
142
|
| `getContents` | `(data: Options) => string \| Promise<string>`{lang="ts"} | `false` | A function that will be called with the `options` object. It should return a string or a promise that resolves to a string. If `src` is provided, this function will be ignored. |
|
|
143
143
|
|
|
144
144
|
**context**: An optional context object can be passed to control where the type is added. If omitted, the type will only be added to the Nuxt context. This object supports the following properties:
|
|
145
145
|
|
|
146
|
-
| Property
|
|
147
|
-
|
|
148
|
-
| `nuxt`
|
|
149
|
-
| `nitro`
|
|
146
|
+
| Property | Type | Required | Description |
|
|
147
|
+
|----------|-----------|----------|----------------------------------------------------------------|
|
|
148
|
+
| `nuxt` | `boolean` | `false` | If set to `true`, the type will be added to the Nuxt context. |
|
|
149
|
+
| `nitro` | `boolean` | `false` | If set to `true`, the type will be added to the Nitro context. |
|
|
150
150
|
|
|
151
151
|
### Examples
|
|
152
152
|
|
|
@@ -226,9 +226,9 @@ function addServerTemplate (template: NuxtServerTemplate): NuxtServerTemplate
|
|
|
226
226
|
|
|
227
227
|
**template**: A template object. It must have the following properties:
|
|
228
228
|
|
|
229
|
-
| Property | Type | Required | Description
|
|
230
|
-
|
|
231
|
-
| `filename` | `string` | `true` | Filename of the template.
|
|
229
|
+
| Property | Type | Required | Description |
|
|
230
|
+
|---------------|----------------------------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------|
|
|
231
|
+
| `filename` | `string` | `true` | Filename of the template. |
|
|
232
232
|
| `getContents` | `() => string \| Promise<string>`{lang="ts"} | `true` | A function that will be called with the `options` object. It should return a string or a promise that resolves to a string. |
|
|
233
233
|
|
|
234
234
|
### Examples
|
|
@@ -304,6 +304,6 @@ async function updateTemplates (options: UpdateTemplatesOptions): void
|
|
|
304
304
|
|
|
305
305
|
**options**: Options to pass to the template. This object can have the following property:
|
|
306
306
|
|
|
307
|
-
| Property
|
|
308
|
-
|
|
309
|
-
| `filter`
|
|
307
|
+
| Property | Type | Required | Description |
|
|
308
|
+
|----------|----------------------------------------------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
309
|
+
| `filter` | `(template: ResolvedNuxtTemplate) => boolean`{lang="ts"} | `false` | A function that will be called with the `template` object. It should return a boolean indicating whether the template should be regenerated. If `filter` is not provided, all templates will be regenerated. |
|
|
@@ -41,13 +41,13 @@ function addServerHandler (handler: NitroEventHandler): void
|
|
|
41
41
|
|
|
42
42
|
**handler**: A handler object with the following properties:
|
|
43
43
|
|
|
44
|
-
| Property
|
|
45
|
-
|
|
46
|
-
| `handler`
|
|
47
|
-
| `route`
|
|
48
|
-
| `middleware
|
|
49
|
-
| `lazy`
|
|
50
|
-
| `method`
|
|
44
|
+
| Property | Type | Required | Description |
|
|
45
|
+
|--------------|-----------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------|
|
|
46
|
+
| `handler` | `string` | `true` | Path to event handler. |
|
|
47
|
+
| `route` | `string` | `false` | Path prefix or route. If an empty string used, will be used as a middleware. |
|
|
48
|
+
| `middleware` | `boolean` | `false` | Specifies this is a middleware handler. Middleware are called on every route and should normally return nothing to pass to the next handlers. |
|
|
49
|
+
| `lazy` | `boolean` | `false` | Use lazy loading to import the handler. This is useful when you only want to load the handler on demand. |
|
|
50
|
+
| `method` | `string` | `false` | Router method matcher. If handler name contains method name, it will be used as a default value. |
|
|
51
51
|
|
|
52
52
|
### Examples
|
|
53
53
|
|
|
@@ -126,10 +126,10 @@ function addDevServerHandler (handler: NitroDevEventHandler): void
|
|
|
126
126
|
|
|
127
127
|
**handler**: A handler object with the following properties:
|
|
128
128
|
|
|
129
|
-
| Property
|
|
130
|
-
|
|
131
|
-
| `handler`
|
|
132
|
-
| `route`
|
|
129
|
+
| Property | Type | Required | Description |
|
|
130
|
+
|-----------|----------------|----------|------------------------------------------------------------------------------|
|
|
131
|
+
| `handler` | `EventHandler` | `true` | Event handler. |
|
|
132
|
+
| `route` | `string` | `false` | Path prefix or route. If an empty string used, will be used as a middleware. |
|
|
133
133
|
|
|
134
134
|
### Examples
|
|
135
135
|
|
|
@@ -222,9 +222,9 @@ function addServerPlugin (plugin: string): void
|
|
|
222
222
|
|
|
223
223
|
### Parameters
|
|
224
224
|
|
|
225
|
-
| Property
|
|
226
|
-
|
|
227
|
-
| `plugin`
|
|
225
|
+
| Property | Type | Required | Description |
|
|
226
|
+
|----------|----------|----------|---------------------------------------------------------------------------------------------------------------|
|
|
227
|
+
| `plugin` | `string` | `true` | Path to the plugin. The plugin must export a default function that accepts the Nitro instance as an argument. |
|
|
228
228
|
|
|
229
229
|
### Examples
|
|
230
230
|
|
|
@@ -293,9 +293,9 @@ function addPrerenderRoutes (routes: string | string[]): void
|
|
|
293
293
|
|
|
294
294
|
### Parameters
|
|
295
295
|
|
|
296
|
-
| Property
|
|
297
|
-
|
|
298
|
-
| `routes`
|
|
296
|
+
| Property | Type | Required | Description |
|
|
297
|
+
|----------|---------------------------------|----------|---------------------------------------------|
|
|
298
|
+
| `routes` | `string \| string[]`{lang="ts"} | `true` | A route or an array of routes to prerender. |
|
|
299
299
|
|
|
300
300
|
## `addServerImports`
|
|
301
301
|
|
|
@@ -333,16 +333,16 @@ function addServerImports (dirs: Import | Import[]): void
|
|
|
333
333
|
|
|
334
334
|
`imports`: An object or an array of objects with the following properties:
|
|
335
335
|
|
|
336
|
-
| Property
|
|
337
|
-
|
|
338
|
-
| `name`
|
|
339
|
-
| `from`
|
|
340
|
-
| `priority`
|
|
341
|
-
| `disabled`
|
|
342
|
-
| `meta`
|
|
343
|
-
| `type`
|
|
344
|
-
| `typeFrom`
|
|
345
|
-
| `as`
|
|
336
|
+
| Property | Type | Required | Description |
|
|
337
|
+
|------------|-----------------------|----------|-----------------------------------------------------------------------------------------------------------------|
|
|
338
|
+
| `name` | `string` | `true` | Import name to be detected. |
|
|
339
|
+
| `from` | `string` | `true` | Module specifier to import from. |
|
|
340
|
+
| `priority` | `number` | `false` | Priority of the import; if multiple imports have the same name, the one with the highest priority will be used. |
|
|
341
|
+
| `disabled` | `boolean` | `false` | If this import is disabled. |
|
|
342
|
+
| `meta` | `Record<string, any>` | `false` | Metadata of the import. |
|
|
343
|
+
| `type` | `boolean` | `false` | If this import is a pure type import. |
|
|
344
|
+
| `typeFrom` | `string` | `false` | Use this as the `from` value when generating type declarations. |
|
|
345
|
+
| `as` | `string` | `false` | Import as this name. |
|
|
346
346
|
|
|
347
347
|
## `addServerImportsDir`
|
|
348
348
|
|
|
@@ -373,10 +373,10 @@ function addServerImportsDir (dirs: string | string[], opts: { prepend?: boolean
|
|
|
373
373
|
|
|
374
374
|
### Parameters
|
|
375
375
|
|
|
376
|
-
| Property
|
|
377
|
-
|
|
378
|
-
| `dirs`
|
|
379
|
-
| `opts`
|
|
376
|
+
| Property | Type | Required | Description |
|
|
377
|
+
|----------|---------------------------------|----------|---------------------------------------------------------------------------------------------------------------------|
|
|
378
|
+
| `dirs` | `string \| string[]`{lang="ts"} | `true` | A directory or an array of directories to register to be scanned by Nitro. |
|
|
379
|
+
| `opts` | `{ prepend?: boolean }` | `false` | Options for the import directory. If `prepend` is `true`, the directory is added to the beginning of the scan list. |
|
|
380
380
|
|
|
381
381
|
### Examples
|
|
382
382
|
|
|
@@ -453,10 +453,10 @@ function addServerScanDir (dirs: string | string[], opts: { prepend?: boolean })
|
|
|
453
453
|
|
|
454
454
|
### Parameters
|
|
455
455
|
|
|
456
|
-
| Property
|
|
457
|
-
|
|
458
|
-
| `dirs`
|
|
459
|
-
| `opts`
|
|
456
|
+
| Property | Type | Required | Description |
|
|
457
|
+
|----------|---------------------------------|----------|---------------------------------------------------------------------------------------------------------------------|
|
|
458
|
+
| `dirs` | `string \| string[]`{lang="ts"} | `true` | A directory or an array of directories to register to be scanned for by Nitro as server dirs. |
|
|
459
|
+
| `opts` | `{ prepend?: boolean }` | `false` | Options for the import directory. If `prepend` is `true`, the directory is added to the beginning of the scan list. |
|
|
460
460
|
|
|
461
461
|
### Examples
|
|
462
462
|
|
|
@@ -83,8 +83,8 @@ import type { ExtendViteConfigOptions } from '@nuxt/kit'
|
|
|
83
83
|
function extendViteConfig (callback: ((config: ViteConfig) => void), options?: ExtendViteConfigOptions): void
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
::read-more{to="https://vite.dev/config" target="_blank" icon="i-simple-icons-vite"}
|
|
87
|
-
|
|
86
|
+
::read-more{to="https://vite.dev/config/" target="_blank" icon="i-simple-icons-vite"}
|
|
87
|
+
Check out the Vite website for more information about its configuration.
|
|
88
88
|
::
|
|
89
89
|
|
|
90
90
|
### Parameters
|
|
@@ -93,13 +93,13 @@ Checkout Vite website for more information about its configuration.
|
|
|
93
93
|
|
|
94
94
|
**`options`**: Options to pass to the callback function. This object can have the following properties:
|
|
95
95
|
|
|
96
|
-
| Property | Type | Required | Description
|
|
97
|
-
|
|
98
|
-
| `dev` | `boolean` | `false` | If set to `true`, the callback function will be called when building in development mode.
|
|
99
|
-
| `build` | `boolean` | `false` | If set to `true`, the callback function will be called when building in production mode.
|
|
96
|
+
| Property | Type | Required | Description |
|
|
97
|
+
|-----------|-----------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
98
|
+
| `dev` | `boolean` | `false` | If set to `true`, the callback function will be called when building in development mode. |
|
|
99
|
+
| `build` | `boolean` | `false` | If set to `true`, the callback function will be called when building in production mode. |
|
|
100
100
|
| `server` | `boolean` | `false` | If set to `true`, the callback function will be called when building the server bundle. **Deprecated in Nuxt 5+.** Use `addVitePlugin()` with `applyToEnvironment()` instead. |
|
|
101
101
|
| `client` | `boolean` | `false` | If set to `true`, the callback function will be called when building the client bundle. **Deprecated in Nuxt 5+.** Use `addVitePlugin()` with `applyToEnvironment()` instead. |
|
|
102
|
-
| `prepend` | `boolean` | `false` | If set to `true`, the callback function will be prepended to the array with `unshift()` instead of `push()`.
|
|
102
|
+
| `prepend` | `boolean` | `false` | If set to `true`, the callback function will be prepended to the array with `unshift()` instead of `push()`. |
|
|
103
103
|
|
|
104
104
|
## `extendWebpackConfig`
|
|
105
105
|
|
|
@@ -132,8 +132,8 @@ import type { ExtendWebpackConfigOptions } from '@nuxt/kit'
|
|
|
132
132
|
function extendWebpackConfig (callback: ((config: WebpackConfig) => void), options?: ExtendWebpackConfigOptions): void
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
-
::read-more{to="https://webpack.js.org/configuration" target="_blank" icon="i-simple-icons-webpack"}
|
|
136
|
-
|
|
135
|
+
::read-more{to="https://webpack.js.org/configuration/" target="_blank" icon="i-simple-icons-webpack"}
|
|
136
|
+
Check out webpack website for more information about its configuration.
|
|
137
137
|
::
|
|
138
138
|
|
|
139
139
|
### Parameters
|
|
@@ -143,7 +143,7 @@ Checkout webpack website for more information about its configuration.
|
|
|
143
143
|
**`options`**: Options to pass to the callback function. This object can have the following properties:
|
|
144
144
|
|
|
145
145
|
| Property | Type | Required | Description |
|
|
146
|
-
|
|
146
|
+
|-----------|-----------|----------|--------------------------------------------------------------------------------------------------------------|
|
|
147
147
|
| `dev` | `boolean` | `false` | If set to `true`, the callback function will be called when building in development mode. |
|
|
148
148
|
| `build` | `boolean` | `false` | If set to `true`, the callback function will be called when building in production mode. |
|
|
149
149
|
| `server` | `boolean` | `false` | If set to `true`, the callback function will be called when building the server bundle. |
|
|
@@ -202,7 +202,7 @@ function addVitePlugin (pluginOrGetter: VitePlugin | VitePlugin[] | (() => ViteP
|
|
|
202
202
|
```
|
|
203
203
|
|
|
204
204
|
::tip
|
|
205
|
-
See [Vite website](https://vite.dev/guide/api-plugin
|
|
205
|
+
See [Vite website](https://vite.dev/guide/api-plugin) for more information about Vite plugins. You can also use [this repository](https://github.com/vitejs/awesome-vite#plugins) to find a plugin that suits your needs.
|
|
206
206
|
::
|
|
207
207
|
|
|
208
208
|
### Parameters
|
|
@@ -211,13 +211,13 @@ See [Vite website](https://vite.dev/guide/api-plugin.html) for more information
|
|
|
211
211
|
|
|
212
212
|
**`options`**: Options to pass to the callback function. This object can have the following properties:
|
|
213
213
|
|
|
214
|
-
| Property | Type | Required | Description
|
|
215
|
-
|
|
216
|
-
| `dev` | `boolean` | `false` | If set to `true`, the callback function will be called when building in development mode.
|
|
217
|
-
| `build` | `boolean` | `false` | If set to `true`, the callback function will be called when building in production mode.
|
|
214
|
+
| Property | Type | Required | Description |
|
|
215
|
+
|-----------|-----------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
216
|
+
| `dev` | `boolean` | `false` | If set to `true`, the callback function will be called when building in development mode. |
|
|
217
|
+
| `build` | `boolean` | `false` | If set to `true`, the callback function will be called when building in production mode. |
|
|
218
218
|
| `server` | `boolean` | `false` | If set to `true`, the callback function will be called when building the server bundle. **Deprecated in Nuxt 5+.** Use `applyToEnvironment()` instead. |
|
|
219
219
|
| `client` | `boolean` | `false` | If set to `true`, the callback function will be called when building the client bundle. **Deprecated in Nuxt 5+.** Use `applyToEnvironment()` instead. |
|
|
220
|
-
| `prepend` | `boolean` | `false` | If set to `true`, the callback function will be prepended to the array with `unshift()` instead of `push()`.
|
|
220
|
+
| `prepend` | `boolean` | `false` | If set to `true`, the callback function will be prepended to the array with `unshift()` instead of `push()`. |
|
|
221
221
|
|
|
222
222
|
## `addWebpackPlugin`
|
|
223
223
|
|
|
@@ -261,7 +261,7 @@ function addWebpackPlugin (pluginOrGetter: WebpackPluginInstance | WebpackPlugin
|
|
|
261
261
|
```
|
|
262
262
|
|
|
263
263
|
::tip
|
|
264
|
-
See [webpack website](https://webpack.js.org/concepts/plugins) for more information about webpack plugins. You can also use [this collection](https://webpack.js.org/awesome-webpack/#webpack-plugins) to find a plugin that suits your needs.
|
|
264
|
+
See [webpack website](https://webpack.js.org/concepts/plugins/) for more information about webpack plugins. You can also use [this collection](https://webpack.js.org/awesome-webpack/#webpack-plugins) to find a plugin that suits your needs.
|
|
265
265
|
::
|
|
266
266
|
|
|
267
267
|
### Parameters
|
|
@@ -270,8 +270,8 @@ See [webpack website](https://webpack.js.org/concepts/plugins) for more informat
|
|
|
270
270
|
|
|
271
271
|
**`options`**: Options to pass to the callback function. This object can have the following properties:
|
|
272
272
|
|
|
273
|
-
| Property | Type | Required | Description
|
|
274
|
-
|
|
273
|
+
| Property | Type | Required | Description |
|
|
274
|
+
|-----------|-----------|----------|--------------------------------------------------------------------------------------------------------------|
|
|
275
275
|
| `dev` | `boolean` | `false` | If set to `true`, the callback function will be called when building in development mode. |
|
|
276
276
|
| `build` | `boolean` | `false` | If set to `true`, the callback function will be called when building in production mode. |
|
|
277
277
|
| `server` | `boolean` | `false` | If set to `true`, the callback function will be called when building the server bundle. |
|
|
@@ -306,8 +306,8 @@ function addBuildPlugin (pluginFactory: AddBuildPluginFactory, options?: ExtendC
|
|
|
306
306
|
|
|
307
307
|
**`options`**: Options to pass to the callback function. This object can have the following properties:
|
|
308
308
|
|
|
309
|
-
| Property | Type | Required | Description
|
|
310
|
-
|
|
309
|
+
| Property | Type | Required | Description |
|
|
310
|
+
|-----------|-----------|----------|--------------------------------------------------------------------------------------------------------------|
|
|
311
311
|
| `dev` | `boolean` | `false` | If set to `true`, the callback function will be called when building in development mode. |
|
|
312
312
|
| `build` | `boolean` | `false` | If set to `true`, the callback function will be called when building in production mode. |
|
|
313
313
|
| `server` | `boolean` | `false` | If set to `true`, the callback function will be called when building the server bundle. |
|
|
@@ -85,18 +85,18 @@ This ordering matches Nuxt's layer resolution system, where user-defined configu
|
|
|
85
85
|
|
|
86
86
|
**`LayerDirectories`**: An object containing the resolved directory paths for a layer.
|
|
87
87
|
|
|
88
|
-
| Property | Type | Description
|
|
89
|
-
|
|
90
|
-
| `root` | `string` | The root directory of the layer (equivalent to `rootDir`)
|
|
91
|
-
| `server` | `string` | The server directory for Nitro server-side code
|
|
92
|
-
| `modules` | `string` | The local modules directory
|
|
93
|
-
| `shared` | `string` | The shared directory for code used by both client and server
|
|
94
|
-
| `app` | `string` | The source directory of the layer (equivalent to `srcDir`)
|
|
95
|
-
| `public` | `string` | The public directory for static assets
|
|
96
|
-
| `appLayouts` | `string` | The layouts directory for Vue layout components
|
|
97
|
-
| `appMiddleware` | `string` | The middleware directory for route middleware
|
|
98
|
-
| `appPages` | `string` | The pages directory for file-based routing
|
|
99
|
-
| `appPlugins` | `string` | The plugins directory for Nuxt plugins
|
|
88
|
+
| Property | Type | Description |
|
|
89
|
+
|-----------------|----------|--------------------------------------------------------------|
|
|
90
|
+
| `root` | `string` | The root directory of the layer (equivalent to `rootDir`) |
|
|
91
|
+
| `server` | `string` | The server directory for Nitro server-side code |
|
|
92
|
+
| `modules` | `string` | The local modules directory |
|
|
93
|
+
| `shared` | `string` | The shared directory for code used by both client and server |
|
|
94
|
+
| `app` | `string` | The source directory of the layer (equivalent to `srcDir`) |
|
|
95
|
+
| `public` | `string` | The public directory for static assets |
|
|
96
|
+
| `appLayouts` | `string` | The layouts directory for Vue layout components |
|
|
97
|
+
| `appMiddleware` | `string` | The middleware directory for route middleware |
|
|
98
|
+
| `appPages` | `string` | The pages directory for file-based routing |
|
|
99
|
+
| `appPlugins` | `string` | The plugins directory for Nuxt plugins |
|
|
100
100
|
|
|
101
101
|
### Examples
|
|
102
102
|
|
|
@@ -4,11 +4,11 @@ description: Nuxt Kit provides a set of utilities to help you work with Nuxt pro
|
|
|
4
4
|
links:
|
|
5
5
|
- label: Source
|
|
6
6
|
icon: i-simple-icons-github
|
|
7
|
-
to: https://github.com/nuxt/nuxt/
|
|
7
|
+
to: https://github.com/nuxt/nuxt/tree/main/packages/kit/src/loader
|
|
8
8
|
size: xs
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
Programmatic usage can be helpful when you want to use Nuxt programmatically, for example, when building a [CLI tool](https://github.com/nuxt/cli) or [test utils](https://github.com/nuxt/
|
|
11
|
+
Programmatic usage can be helpful when you want to use Nuxt programmatically, for example, when building a [CLI tool](https://github.com/nuxt/cli) or [test utils](https://github.com/nuxt/test-utils).
|
|
12
12
|
|
|
13
13
|
## `loadNuxt`
|
|
14
14
|
|