@nuxt/docs 3.20.1 → 3.21.0
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 +5 -5
- package/1.getting-started/02.installation.md +4 -7
- package/1.getting-started/03.configuration.md +32 -32
- package/1.getting-started/04.views.md +10 -8
- package/1.getting-started/05.assets.md +8 -8
- package/1.getting-started/06.styling.md +24 -18
- package/1.getting-started/07.routing.md +11 -11
- package/1.getting-started/08.seo-meta.md +10 -6
- package/1.getting-started/09.transitions.md +12 -12
- package/1.getting-started/10.data-fetching.md +18 -18
- package/1.getting-started/11.state-management.md +7 -7
- package/1.getting-started/12.error-handling.md +28 -22
- package/1.getting-started/13.server.md +9 -9
- package/1.getting-started/14.layers.md +52 -18
- package/1.getting-started/15.prerendering.md +10 -4
- package/1.getting-started/16.deployment.md +3 -2
- package/1.getting-started/17.testing.md +18 -8
- package/1.getting-started/18.upgrade.md +111 -60
- 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 +2 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.assets.md +3 -3
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.components.md +13 -9
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.composables.md +4 -4
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.content.md +2 -2
- package/2.directory-structure/1.layers.md +87 -0
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.layouts.md +37 -5
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.middleware.md +8 -8
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.modules.md +10 -4
- 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.pages.md +43 -22
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.plugins.md +6 -3
- 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 +29 -9
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.shared.md +4 -4
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.utils.md +5 -5
- package/{2.guide/1.directory-structure → 2.directory-structure}/2.env.md +4 -4
- package/{2.guide/1.directory-structure → 2.directory-structure}/2.nuxtignore.md +2 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/2.nuxtrc.md +6 -3
- package/{2.guide/1.directory-structure → 2.directory-structure}/3.app-config.md +2 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/3.app.md +5 -5
- package/{2.guide/1.directory-structure → 2.directory-structure}/3.error.md +10 -8
- package/{2.guide/1.directory-structure → 2.directory-structure}/3.nuxt-config.md +2 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/3.package.md +1 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/3.tsconfig.md +3 -2
- package/2.directory-structure/index.md +65 -0
- package/3.guide/0.index.md +28 -0
- package/{2.guide/2.concepts/3.rendering.md → 3.guide/1.concepts/1.rendering.md} +8 -33
- package/{2.guide/2.concepts/2.vuejs-development.md → 3.guide/1.concepts/10.vuejs-development.md} +11 -10
- package/{2.guide/2.concepts/10.nuxt-lifecycle.md → 3.guide/1.concepts/2.nuxt-lifecycle.md} +34 -27
- package/{2.guide/2.concepts/1.auto-imports.md → 3.guide/1.concepts/3.auto-imports.md} +10 -10
- 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 +15 -2
- package/{2.guide/2.concepts → 3.guide/1.concepts}/7.esm.md +5 -4
- package/{2.guide/2.concepts → 3.guide/1.concepts}/8.typescript.md +11 -17
- 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 +5 -5
- package/3.guide/3.ai/.navigation.yml +3 -0
- package/3.guide/3.ai/1.mcp.md +277 -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 +330 -0
- package/3.guide/4.modules/4.recipes-advanced.md +243 -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 +4 -4
- package/{2.guide/4.recipes → 3.guide/5.recipes}/2.vite-plugin.md +5 -1
- package/{2.guide/4.recipes → 3.guide/5.recipes}/3.custom-usefetch.md +3 -3
- package/{2.guide/4.recipes → 3.guide/5.recipes}/4.sessions-and-authentication.md +2 -2
- package/{2.guide/3.going-further → 3.guide/6.going-further}/1.events.md +3 -4
- package/{2.guide/3.going-further → 3.guide/6.going-further}/1.experimental-features.md +212 -87
- package/3.guide/6.going-further/1.features.md +108 -0
- 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 +3 -3
- package/{2.guide/3.going-further → 3.guide/6.going-further}/11.nightly-release-channel.md +1 -1
- package/{2.guide/3.going-further → 3.guide/6.going-further}/2.hooks.md +7 -7
- package/{2.guide/3.going-further → 3.guide/6.going-further}/4.kit.md +3 -3
- package/{2.guide/3.going-further → 3.guide/6.going-further}/6.nuxt-app.md +6 -6
- package/{2.guide/3.going-further → 3.guide/6.going-further}/7.layers.md +40 -14
- package/{2.guide/3.going-further → 3.guide/6.going-further}/9.debugging.md +3 -2
- package/{3.api → 4.api}/1.components/1.nuxt-client-fallback.md +5 -1
- package/{3.api → 4.api}/1.components/10.nuxt-picture.md +1 -1
- package/{3.api → 4.api}/1.components/11.teleports.md +2 -2
- 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 +4 -4
- package/{3.api → 4.api}/1.components/3.nuxt-layout.md +7 -7
- package/{3.api → 4.api}/1.components/4.nuxt-link.md +13 -13
- package/{3.api → 4.api}/1.components/5.nuxt-loading-indicator.md +2 -2
- package/{3.api → 4.api}/1.components/6.nuxt-error-boundary.md +2 -2
- package/{3.api → 4.api}/1.components/7.nuxt-welcome.md +2 -2
- package/{3.api → 4.api}/1.components/8.nuxt-island.md +9 -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 +5 -5
- package/4.api/2.composables/use-cookie.md +183 -0
- package/{3.api → 4.api}/2.composables/use-error.md +3 -3
- package/{3.api → 4.api}/2.composables/use-fetch.md +37 -37
- package/{3.api → 4.api}/2.composables/use-head-safe.md +1 -1
- package/{3.api → 4.api}/2.composables/use-head.md +22 -7
- package/{3.api → 4.api}/2.composables/use-lazy-async-data.md +1 -1
- package/{3.api → 4.api}/2.composables/use-lazy-fetch.md +9 -9
- package/{3.api → 4.api}/2.composables/use-nuxt-app.md +11 -9
- 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 +5 -5
- package/{3.api → 4.api}/2.composables/use-seo-meta.md +2 -2
- package/{3.api → 4.api}/2.composables/use-server-seo-meta.md +2 -2
- package/{3.api → 4.api}/2.composables/use-state.md +12 -2
- package/{3.api → 4.api}/3.utils/$fetch.md +2 -2
- 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 +2 -4
- package/{3.api → 4.api}/3.utils/clear-error.md +1 -1
- package/{3.api → 4.api}/3.utils/create-error.md +7 -7
- package/{3.api → 4.api}/3.utils/define-lazy-hydration-component.md +5 -5
- package/{3.api → 4.api}/3.utils/define-nuxt-component.md +1 -1
- package/{3.api → 4.api}/3.utils/define-nuxt-plugin.md +12 -12
- package/{3.api → 4.api}/3.utils/define-nuxt-route-middleware.md +3 -3
- package/{3.api → 4.api}/3.utils/define-page-meta.md +23 -16
- package/{3.api → 4.api}/3.utils/define-route-rules.md +2 -2
- package/{3.api → 4.api}/3.utils/navigate-to.md +14 -14
- 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/preload-route-components.md +2 -2
- package/{3.api → 4.api}/3.utils/refresh-cookie.md +0 -2
- package/{3.api → 4.api}/3.utils/refresh-nuxt-data.md +1 -1
- package/{3.api → 4.api}/3.utils/reload-nuxt-app.md +1 -1
- package/{3.api → 4.api}/3.utils/set-page-layout.md +36 -0
- package/{3.api → 4.api}/3.utils/set-response-status.md +3 -3
- package/{3.api → 4.api}/3.utils/show-error.md +4 -4
- 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 +31 -18
- package/{3.api → 4.api}/5.kit/10.templates.md +23 -23
- package/{3.api → 4.api}/5.kit/11.nitro.md +36 -36
- package/{3.api → 4.api}/5.kit/12.resolving.md +2 -2
- package/{3.api → 4.api}/5.kit/14.builder.md +35 -23
- package/{3.api → 4.api}/5.kit/16.layers.md +16 -16
- package/{3.api → 4.api}/5.kit/2.programmatic.md +2 -2
- package/{3.api → 4.api}/5.kit/3.compatibility.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/{3.api → 4.api}/5.kit/6.context.md +1 -1
- package/{3.api → 4.api}/5.kit/8.layout.md +1 -1
- package/4.api/6.advanced/1.hooks.md +105 -0
- package/{3.api → 4.api}/index.md +7 -7
- package/5.community/4.contribution.md +10 -10
- package/5.community/5.framework-contribution.md +9 -9
- package/5.community/6.roadmap.md +25 -25
- package/5.community/7.changelog.md +20 -0
- package/6.bridge/1.overview.md +9 -1
- package/6.bridge/3.bridge-composition-api.md +2 -2
- package/6.bridge/4.plugins-and-middleware.md +4 -4
- package/6.bridge/5.nuxt3-compatible-api.md +1 -1
- package/6.bridge/8.nitro.md +4 -0
- package/7.migration/10.bundling.md +1 -1
- package/7.migration/11.server.md +3 -3
- package/7.migration/2.configuration.md +6 -6
- package/7.migration/20.module-authors.md +3 -3
- package/7.migration/3.auto-imports.md +1 -1
- package/7.migration/4.meta.md +1 -1
- package/7.migration/5.plugins-and-middleware.md +3 -3
- package/7.migration/6.pages-and-layouts.md +9 -9
- package/7.migration/7.component-options.md +6 -6
- package/7.migration/8.runtime-config.md +1 -1
- package/package.json +1 -1
- package/2.guide/0.index.md +0 -25
- package/2.guide/3.going-further/1.features.md +0 -103
- 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-router.md +0 -94
- 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}/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}/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/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-hydration.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-loading-indicator.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-nuxt-data.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-fetch.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-runtime-hook.md +0 -0
- /package/{3.api → 4.api}/3.utils/.navigation.yml +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/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/prerender-routes.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/13.logging.md +0 -0
- /package/{3.api → 4.api}/5.kit/15.examples.md +0 -0
- /package/{3.api → 4.api}/5.kit/7.pages.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}/6.nuxt-config.md +0 -0
|
@@ -17,7 +17,7 @@ Make sure to always use `await` or `return` on result of `navigateTo` when calli
|
|
|
17
17
|
::
|
|
18
18
|
|
|
19
19
|
::note
|
|
20
|
-
`navigateTo` cannot be used within Nitro routes. To perform a server-side redirect in Nitro routes, use [`sendRedirect`](https://h3.dev/utils/response#
|
|
20
|
+
`navigateTo` cannot be used within Nitro routes. To perform a server-side redirect in Nitro routes, use [`sendRedirect`](https://h3.dev/utils/response#redirectlocation-status-statustext) instead.
|
|
21
21
|
::
|
|
22
22
|
|
|
23
23
|
### Within a Vue Component
|
|
@@ -68,7 +68,7 @@ export default defineNuxtRouteMiddleware((to, from) => {
|
|
|
68
68
|
|
|
69
69
|
In this case, `navigateTo` will be executed but not returned, which may lead to unexpected behavior.
|
|
70
70
|
|
|
71
|
-
:read-more{to="/docs/
|
|
71
|
+
:read-more{to="/docs/3.x/directory-structure/middleware"}
|
|
72
72
|
|
|
73
73
|
### Navigating to an External URL
|
|
74
74
|
|
|
@@ -148,7 +148,7 @@ type OpenWindowFeatures = {
|
|
|
148
148
|
|
|
149
149
|
### `to`
|
|
150
150
|
|
|
151
|
-
**Type**: [`RouteLocationRaw`](https://router.vuejs.org/api/interfaces/
|
|
151
|
+
**Type**: [`RouteLocationRaw`](https://router.vuejs.org/api/interfaces/routelocationoptions) | `undefined` | `null`
|
|
152
152
|
|
|
153
153
|
**Default**: `'/'`
|
|
154
154
|
|
|
@@ -186,9 +186,9 @@ An object accepting the following properties:
|
|
|
186
186
|
- **Type**: `number`
|
|
187
187
|
- **Default**: `302`
|
|
188
188
|
|
|
189
|
-
- `navigateTo` redirects to the given path and sets the redirect code to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302) by default when the redirection takes place on the server side.
|
|
189
|
+
- `navigateTo` redirects to the given path and sets the redirect code to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/302) by default when the redirection takes place on the server side.
|
|
190
190
|
|
|
191
|
-
This default behavior can be modified by providing different `redirectCode`. Commonly, [`301 Moved Permanently`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/301) can be used for permanent redirections.
|
|
191
|
+
This default behavior can be modified by providing different `redirectCode`. Commonly, [`301 Moved Permanently`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/301) can be used for permanent redirections.
|
|
192
192
|
|
|
193
193
|
- `external`
|
|
194
194
|
|
|
@@ -217,14 +217,14 @@ An object accepting the following properties:
|
|
|
217
217
|
|
|
218
218
|
- An object accepting the following properties:
|
|
219
219
|
|
|
220
|
-
| Property
|
|
221
|
-
|
|
222
|
-
| `popup`
|
|
223
|
-
| `width` or `innerWidth`
|
|
224
|
-
| `height` or `innerHeight` | `number` | Specifies the content area's height (minimum 100 pixels), including scrollbars.
|
|
225
|
-
| `left` or `screenX`
|
|
226
|
-
| `top` or `screenY`
|
|
227
|
-
| `noopener`
|
|
228
|
-
| `noreferrer`
|
|
220
|
+
| Property | Type | Description |
|
|
221
|
+
|---------------------------|-----------|------------------------------------------------------------------------------------------------|
|
|
222
|
+
| `popup` | `boolean` | Requests a minimal popup window instead of a new tab, with UI features decided by the browser. |
|
|
223
|
+
| `width` or `innerWidth` | `number` | Specifies the content area's width (minimum 100 pixels), including scrollbars. |
|
|
224
|
+
| `height` or `innerHeight` | `number` | Specifies the content area's height (minimum 100 pixels), including scrollbars. |
|
|
225
|
+
| `left` or `screenX` | `number` | Sets the horizontal position of the new window relative to the left edge of the screen. |
|
|
226
|
+
| `top` or `screenY` | `number` | Sets the vertical position of the new window relative to the top edge of the screen. |
|
|
227
|
+
| `noopener` | `boolean` | Prevents the new window from accessing the originating window via `window.opener`. |
|
|
228
|
+
| `noreferrer` | `boolean` | Prevents the Referer header from being sent and implicitly enables `noopener`. |
|
|
229
229
|
|
|
230
230
|
Refer to the [documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/open#windowfeatures) for more detailed information on the **windowFeatures** properties.
|
|
@@ -8,4 +8,4 @@ links:
|
|
|
8
8
|
size: xs
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
:read-more{icon="i-simple-icons-vuedotjs" to="https://router.vuejs.org/api/functions/
|
|
11
|
+
:read-more{icon="i-simple-icons-vuedotjs" to="https://router.vuejs.org/api/functions/onbeforerouteleave" title="Vue Router Docs" target="_blank"}
|
|
@@ -8,4 +8,4 @@ links:
|
|
|
8
8
|
size: xs
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
:read-more{icon="i-simple-icons-vuedotjs" to="https://router.vuejs.org/api/functions/
|
|
11
|
+
:read-more{icon="i-simple-icons-vuedotjs" to="https://router.vuejs.org/api/functions/onbeforerouteupdate" title="Vue Router Docs" target="_blank"}
|
|
@@ -14,7 +14,7 @@ Preloading routes loads the components of a given route that the user might navi
|
|
|
14
14
|
Nuxt already automatically preloads the necessary routes if you're using the `NuxtLink` component.
|
|
15
15
|
::
|
|
16
16
|
|
|
17
|
-
:read-more{to="/docs/api/components/nuxt-link"}
|
|
17
|
+
:read-more{to="/docs/3.x/api/components/nuxt-link"}
|
|
18
18
|
|
|
19
19
|
## Example
|
|
20
20
|
|
|
@@ -34,7 +34,7 @@ const submit = async () => {
|
|
|
34
34
|
}
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
:read-more{to="/docs/api/utils/navigate-to"}
|
|
37
|
+
:read-more{to="/docs/3.x/api/utils/navigate-to"}
|
|
38
38
|
|
|
39
39
|
::note
|
|
40
40
|
On server, `preloadRouteComponents` will have no effect.
|
|
@@ -93,4 +93,4 @@ async function refresh () {
|
|
|
93
93
|
If you have access to the `asyncData` instance, it is recommended to use its `refresh` or `execute` method as the preferred way to refetch the data.
|
|
94
94
|
::
|
|
95
95
|
|
|
96
|
-
:read-more{to="/docs/getting-started/data-fetching"}
|
|
96
|
+
:read-more{to="/docs/3.x/getting-started/data-fetching"}
|
|
@@ -14,7 +14,7 @@ links:
|
|
|
14
14
|
|
|
15
15
|
By default, it will also save the current `state` of your app (that is, any state you could access with `useState`).
|
|
16
16
|
|
|
17
|
-
::read-more{to="/docs/guide/going-further/experimental-features#restorestate" icon="i-lucide-star"}
|
|
17
|
+
::read-more{to="/docs/3.x/guide/going-further/experimental-features#restorestate" icon="i-lucide-star"}
|
|
18
18
|
You can enable experimental restoration of this state by enabling the `experimental.restoreState` option in your `nuxt.config` file.
|
|
19
19
|
::
|
|
20
20
|
|
|
@@ -19,6 +19,42 @@ export default defineNuxtRouteMiddleware((to) => {
|
|
|
19
19
|
})
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
## Passing Props to Layouts
|
|
23
|
+
|
|
24
|
+
You can pass props to the layout by providing an object as the second argument:
|
|
25
|
+
|
|
26
|
+
```ts [middleware/admin-layout.ts]
|
|
27
|
+
export default defineNuxtRouteMiddleware((to) => {
|
|
28
|
+
setPageLayout('admin', {
|
|
29
|
+
sidebar: true,
|
|
30
|
+
title: 'Dashboard',
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The layout can then receive these props:
|
|
36
|
+
|
|
37
|
+
```vue [layouts/admin.vue]
|
|
38
|
+
<script setup lang="ts">
|
|
39
|
+
const props = defineProps<{
|
|
40
|
+
sidebar?: boolean
|
|
41
|
+
title?: string
|
|
42
|
+
}>()
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<div>
|
|
47
|
+
<aside v-if="sidebar">
|
|
48
|
+
Sidebar
|
|
49
|
+
</aside>
|
|
50
|
+
<main>
|
|
51
|
+
<h1>{{ title }}</h1>
|
|
52
|
+
<slot />
|
|
53
|
+
</main>
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
56
|
+
```
|
|
57
|
+
|
|
22
58
|
::note
|
|
23
59
|
If you choose to set the layout dynamically on the server side, you _must_ do so before the layout is rendered by Vue (that is, within a plugin or route middleware) to avoid a hydration mismatch.
|
|
24
60
|
::
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: 'setResponseStatus'
|
|
3
|
-
description: setResponseStatus sets the
|
|
3
|
+
description: setResponseStatus sets the status (and optionally the statusText) of the response.
|
|
4
4
|
links:
|
|
5
5
|
- label: Source
|
|
6
6
|
icon: i-simple-icons-github
|
|
@@ -10,7 +10,7 @@ links:
|
|
|
10
10
|
|
|
11
11
|
Nuxt provides composables and utilities for first-class server-side-rendering support.
|
|
12
12
|
|
|
13
|
-
`setResponseStatus` sets the
|
|
13
|
+
`setResponseStatus` sets the status (and optionally the statusText) of the response.
|
|
14
14
|
|
|
15
15
|
::important
|
|
16
16
|
`setResponseStatus` can only be called in the [Nuxt context](/docs/3.x/guide/going-further/nuxt-app#the-nuxt-context).
|
|
@@ -33,4 +33,4 @@ if (event) {
|
|
|
33
33
|
In the browser, `setResponseStatus` will have no effect.
|
|
34
34
|
::
|
|
35
35
|
|
|
36
|
-
:read-more{to="/docs/getting-started/error-handling"}
|
|
36
|
+
:read-more{to="/docs/3.x/getting-started/error-handling"}
|
|
@@ -12,13 +12,13 @@ Within the [Nuxt context](/docs/3.x/guide/going-further/nuxt-app#the-nuxt-contex
|
|
|
12
12
|
|
|
13
13
|
**Parameters:**
|
|
14
14
|
|
|
15
|
-
- `error`: `string | Error | Partial<{ cause, data, message, name, stack,
|
|
15
|
+
- `error`: `string | Error | Partial<{ cause, data, message, name, stack, status, statusText }>`
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
18
|
showError('😱 Oh no, an error has been thrown.')
|
|
19
19
|
showError({
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
status: 404,
|
|
21
|
+
statusText: 'Page Not Found',
|
|
22
22
|
})
|
|
23
23
|
```
|
|
24
24
|
|
|
@@ -28,4 +28,4 @@ The error is set in the state using [`useError()`](/docs/3.x/api/composables/use
|
|
|
28
28
|
`showError` calls the `app:error` hook.
|
|
29
29
|
::
|
|
30
30
|
|
|
31
|
-
:read-more{to="/docs/getting-started/error-handling"}
|
|
31
|
+
:read-more{to="/docs/3.x/getting-started/error-handling"}
|
|
@@ -9,7 +9,7 @@ links:
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
::note
|
|
12
|
-
Updates the [`app.config`](/docs/3.x/
|
|
12
|
+
Updates the [`app.config`](/docs/3.x/directory-structure/app-config) using deep assignment. Existing (nested) properties will be preserved.
|
|
13
13
|
::
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
@@ -25,4 +25,4 @@ updateAppConfig(newAppConfig)
|
|
|
25
25
|
console.log(appConfig) // { foo: 'baz' }
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
:read-more{to="/docs/
|
|
28
|
+
:read-more{to="/docs/3.x/directory-structure/app-config"}
|
|
@@ -14,23 +14,23 @@ npx nuxt add <TEMPLATE> <NAME> [--cwd=<directory>] [--logLevel=<silent|info|verb
|
|
|
14
14
|
```
|
|
15
15
|
<!--/add-cmd-->
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
## Arguments
|
|
18
18
|
|
|
19
19
|
<!--add-args-->
|
|
20
|
-
Argument
|
|
21
|
-
|
|
22
|
-
`TEMPLATE` | Specify which template to generate (options: <api\|app\|app-config\|component\|composable\|error\|layer\|layout\|middleware\|module\|page\|plugin\|server-middleware\|server-plugin\|server-route\|server-util>)
|
|
23
|
-
`NAME`
|
|
20
|
+
| Argument | Description |
|
|
21
|
+
|------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
22
|
+
| `TEMPLATE` | Specify which template to generate (options: <api\|app\|app-config\|component\|composable\|error\|layer\|layout\|middleware\|module\|page\|plugin\|server-middleware\|server-plugin\|server-route\|server-util>) |
|
|
23
|
+
| `NAME` | Specify name of the generated file |
|
|
24
24
|
<!--/add-args-->
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
## Options
|
|
27
27
|
|
|
28
28
|
<!--add-opts-->
|
|
29
|
-
Option
|
|
30
|
-
|
|
31
|
-
`--cwd=<directory>`
|
|
32
|
-
`--logLevel=<silent\|info\|verbose>` |
|
|
33
|
-
`--force`
|
|
29
|
+
| Option | Default | Description |
|
|
30
|
+
|--------------------------------------|---------|------------------------------------------|
|
|
31
|
+
| `--cwd=<directory>` | `.` | Specify the working directory |
|
|
32
|
+
| `--logLevel=<silent\|info\|verbose>` | | Specify build-time log level |
|
|
33
|
+
| `--force` | `false` | Force override file if it already exists |
|
|
34
34
|
<!--/add-opts-->
|
|
35
35
|
|
|
36
36
|
**Modifiers:**
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "nuxt analyze"
|
|
3
|
+
description: "Analyze the production bundle or your Nuxt application."
|
|
4
|
+
links:
|
|
5
|
+
- label: Source
|
|
6
|
+
icon: i-simple-icons-github
|
|
7
|
+
to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/analyze.ts
|
|
8
|
+
size: xs
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<!--analyze-cmd-->
|
|
12
|
+
```bash [Terminal]
|
|
13
|
+
npx nuxt analyze [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--dotenv] [-e, --extends=<layer-name>] [--name=<name>] [--no-serve]
|
|
14
|
+
```
|
|
15
|
+
<!--/analyze-cmd-->
|
|
16
|
+
|
|
17
|
+
The `analyze` command builds Nuxt and analyzes the production bundle (experimental).
|
|
18
|
+
|
|
19
|
+
## Arguments
|
|
20
|
+
|
|
21
|
+
<!--analyze-args-->
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
25
|
+
<!--/analyze-args-->
|
|
26
|
+
|
|
27
|
+
## Options
|
|
28
|
+
|
|
29
|
+
<!--analyze-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
|
+
| `--name=<name>` | `default` | Name of the analysis |
|
|
37
|
+
| `--no-serve` | | Skip serving the analysis results |
|
|
38
|
+
<!--/analyze-opts-->
|
|
39
|
+
|
|
40
|
+
::note
|
|
41
|
+
This command sets `process.env.NODE_ENV` to `production`.
|
|
42
|
+
::
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'nuxt build-module'
|
|
3
|
+
description: 'Nuxt command to build your Nuxt module before publishing.'
|
|
4
|
+
links:
|
|
5
|
+
- label: Source
|
|
6
|
+
icon: i-simple-icons-github
|
|
7
|
+
to: https://github.com/nuxt/module-builder/blob/main/src/cli.ts
|
|
8
|
+
size: xs
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<!--build-module-cmd-->
|
|
12
|
+
```bash [Terminal]
|
|
13
|
+
npx nuxt build-module [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--build] [--stub] [--sourcemap] [--prepare]
|
|
14
|
+
```
|
|
15
|
+
<!--/build-module-cmd-->
|
|
16
|
+
|
|
17
|
+
The `build-module` command runs `@nuxt/module-builder` to generate `dist` directory within your `rootDir` that contains the full build for your **nuxt-module**.
|
|
18
|
+
|
|
19
|
+
## Arguments
|
|
20
|
+
|
|
21
|
+
<!--build-module-args-->
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
25
|
+
<!--/build-module-args-->
|
|
26
|
+
|
|
27
|
+
## Options
|
|
28
|
+
|
|
29
|
+
<!--build-module-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
|
+
| `--build` | `false` | Build module for distribution |
|
|
35
|
+
| `--stub` | `false` | Stub dist instead of actually building it for development |
|
|
36
|
+
| `--sourcemap` | `false` | Generate sourcemaps |
|
|
37
|
+
| `--prepare` | `false` | Prepare module for local development |
|
|
38
|
+
<!--/build-module-opts-->
|
|
39
|
+
|
|
40
|
+
::read-more{to="https://github.com/nuxt/module-builder" icon="i-simple-icons-github" target="\_blank"}
|
|
41
|
+
Read more about `@nuxt/module-builder`.
|
|
42
|
+
::
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "nuxt build"
|
|
3
|
+
description: "Build your Nuxt application."
|
|
4
|
+
links:
|
|
5
|
+
- label: Source
|
|
6
|
+
icon: i-simple-icons-github
|
|
7
|
+
to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/build.ts
|
|
8
|
+
size: xs
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<!--build-cmd-->
|
|
12
|
+
```bash [Terminal]
|
|
13
|
+
npx nuxt build [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--prerender] [--preset] [--dotenv] [--envName] [-e, --extends=<layer-name>]
|
|
14
|
+
```
|
|
15
|
+
<!--/build-cmd-->
|
|
16
|
+
|
|
17
|
+
The `build` command creates a `.output` directory with all your application, server and dependencies ready for production.
|
|
18
|
+
|
|
19
|
+
## Arguments
|
|
20
|
+
|
|
21
|
+
<!--build-args-->
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
25
|
+
<!--/build-args-->
|
|
26
|
+
|
|
27
|
+
## Options
|
|
28
|
+
|
|
29
|
+
<!--build-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
|
+
| `--prerender` | | Build Nuxt and prerender static routes |
|
|
35
|
+
| `--preset` | | Nitro server preset |
|
|
36
|
+
| `--dotenv` | | Path to `.env` file to load, relative to the root directory |
|
|
37
|
+
| `--envName` | | The environment to use when resolving configuration overrides (default is `production` when building, and `development` when running the dev server) |
|
|
38
|
+
| `-e, --extends=<layer-name>` | | Extend from a Nuxt layer |
|
|
39
|
+
<!--/build-opts-->
|
|
40
|
+
|
|
41
|
+
::note
|
|
42
|
+
This command sets `process.env.NODE_ENV` to `production`.
|
|
43
|
+
::
|
|
44
|
+
|
|
45
|
+
::note
|
|
46
|
+
`--prerender` will always set the `preset` to `static`
|
|
47
|
+
::
|
|
@@ -24,15 +24,15 @@ The `cleanup` command removes common generated Nuxt files and caches, including:
|
|
|
24
24
|
## Arguments
|
|
25
25
|
|
|
26
26
|
<!--cleanup-args-->
|
|
27
|
-
Argument
|
|
28
|
-
|
|
29
|
-
`ROOTDIR="."` | Specifies the working directory (default: `.`)
|
|
27
|
+
| Argument | Description |
|
|
28
|
+
|---------------|------------------------------------------------|
|
|
29
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
30
30
|
<!--/cleanup-args-->
|
|
31
31
|
|
|
32
32
|
## Options
|
|
33
33
|
|
|
34
34
|
<!--cleanup-opts-->
|
|
35
|
-
Option
|
|
36
|
-
|
|
37
|
-
`--cwd=<directory>` |
|
|
35
|
+
| Option | Default | Description |
|
|
36
|
+
|---------------------|---------|----------------------------------------------------------------------------------|
|
|
37
|
+
| `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
|
|
38
38
|
<!--/cleanup-opts-->
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'nuxt dev'
|
|
3
|
+
description: The dev command starts a development server with hot module replacement at http://localhost:3000
|
|
4
|
+
links:
|
|
5
|
+
- label: Source
|
|
6
|
+
icon: i-simple-icons-github
|
|
7
|
+
to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/dev.ts
|
|
8
|
+
size: xs
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<!--dev-cmd-->
|
|
12
|
+
```bash [Terminal]
|
|
13
|
+
npx nuxt dev [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--dotenv] [--envName] [-e, --extends=<layer-name>] [--clear] [--no-f, --no-fork] [-p, --port] [-h, --host] [--clipboard] [-o, --open] [--https] [--publicURL] [--qr] [--public] [--tunnel] [--sslCert] [--sslKey]
|
|
14
|
+
```
|
|
15
|
+
<!--/dev-cmd-->
|
|
16
|
+
|
|
17
|
+
The `dev` command starts a development server with hot module replacement at [http://localhost:3000](https://localhost:3000)
|
|
18
|
+
|
|
19
|
+
## Arguments
|
|
20
|
+
|
|
21
|
+
<!--dev-args-->
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
25
|
+
<!--/dev-args-->
|
|
26
|
+
|
|
27
|
+
## Options
|
|
28
|
+
|
|
29
|
+
<!--dev-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
|
+
| `--envName` | | The environment to use when resolving configuration overrides (default is `production` when building, and `development` when running the dev server) |
|
|
36
|
+
| `-e, --extends=<layer-name>` | | Extend from a Nuxt layer |
|
|
37
|
+
| `--clear` | `false` | Clear console on restart |
|
|
38
|
+
| `--no-f, --no-fork` | | Disable forked mode |
|
|
39
|
+
| `-p, --port` | | Port to listen on (default: `NUXT_PORT \|\| NITRO_PORT \|\| PORT \|\| nuxtOptions.devServer.port`) |
|
|
40
|
+
| `-h, --host` | | Host to listen on (default: `NUXT_HOST \|\| NITRO_HOST \|\| HOST \|\| nuxtOptions.devServer?.host`) |
|
|
41
|
+
| `--clipboard` | `false` | Copy the URL to the clipboard |
|
|
42
|
+
| `-o, --open` | `false` | Open the URL in the browser |
|
|
43
|
+
| `--https` | | Enable HTTPS |
|
|
44
|
+
| `--publicURL` | | Displayed public URL (used for QR code) |
|
|
45
|
+
| `--qr` | | Display The QR code of public URL when available |
|
|
46
|
+
| `--public` | | Listen to all network interfaces |
|
|
47
|
+
| `--tunnel` | | Open a tunnel using https://github.com/unjs/untun |
|
|
48
|
+
| `--sslCert` | | (DEPRECATED) Use `--https.cert` instead. |
|
|
49
|
+
| `--sslKey` | | (DEPRECATED) Use `--https.key` instead. |
|
|
50
|
+
<!--/dev-opts-->
|
|
51
|
+
|
|
52
|
+
The port and host can also be set via NUXT_PORT, PORT, NUXT_HOST or HOST environment variables.
|
|
53
|
+
|
|
54
|
+
Additionally to the above options, `@nuxt/cli` can pass options through to `listhen`, e.g. `--no-qr` to turn off the dev server QR code. You can find the list of `listhen` options in the [unjs/listhen](https://github.com/unjs/listhen) docs.
|
|
55
|
+
|
|
56
|
+
This command sets `process.env.NODE_ENV` to `development`.
|
|
57
|
+
|
|
58
|
+
::note
|
|
59
|
+
If you are using a self-signed certificate in development, you will need to set `NODE_TLS_REJECT_UNAUTHORIZED=0` in your environment.
|
|
60
|
+
::
|
|
@@ -19,18 +19,18 @@ Running `nuxt devtools enable` will install the Nuxt DevTools globally, and also
|
|
|
19
19
|
## Arguments
|
|
20
20
|
|
|
21
21
|
<!--devtools-args-->
|
|
22
|
-
Argument
|
|
23
|
-
|
|
24
|
-
`COMMAND`
|
|
25
|
-
`ROOTDIR="."` | Specifies the working directory (default: `.`)
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `COMMAND` | Command to run (options: <enable\|disable>) |
|
|
25
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
26
26
|
<!--/devtools-args-->
|
|
27
27
|
|
|
28
28
|
## Options
|
|
29
29
|
|
|
30
30
|
<!--devtools-opts-->
|
|
31
|
-
Option
|
|
32
|
-
|
|
33
|
-
`--cwd=<directory>` |
|
|
31
|
+
| Option | Default | Description |
|
|
32
|
+
|---------------------|---------|----------------------------------------------------------------------------------|
|
|
33
|
+
| `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
|
|
34
34
|
<!--/devtools-opts-->
|
|
35
35
|
|
|
36
36
|
::read-more{icon="i-simple-icons-nuxtdotjs" to="https://devtools.nuxt.com" target="\_blank"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "nuxt generate"
|
|
3
|
+
description: Pre-renders every route of the application and stores the result in plain HTML files.
|
|
4
|
+
links:
|
|
5
|
+
- label: Source
|
|
6
|
+
icon: i-simple-icons-github
|
|
7
|
+
to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/generate.ts
|
|
8
|
+
size: xs
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<!--generate-cmd-->
|
|
12
|
+
```bash [Terminal]
|
|
13
|
+
npx nuxt generate [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--preset] [--dotenv] [--envName] [-e, --extends=<layer-name>]
|
|
14
|
+
```
|
|
15
|
+
<!--/generate-cmd-->
|
|
16
|
+
|
|
17
|
+
The `generate` command pre-renders every route of your application and stores the result in plain HTML files that you can deploy on any static hosting services. The command triggers the `nuxt build` command with the `prerender` argument set to `true`
|
|
18
|
+
|
|
19
|
+
## Arguments
|
|
20
|
+
|
|
21
|
+
<!--generate-args-->
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
25
|
+
<!--/generate-args-->
|
|
26
|
+
|
|
27
|
+
## Options
|
|
28
|
+
|
|
29
|
+
<!--generate-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
|
+
| `--preset` | | Nitro server preset |
|
|
35
|
+
| `--dotenv` | | Path to `.env` file to load, relative to the root directory |
|
|
36
|
+
| `--envName` | | The environment to use when resolving configuration overrides (default is `production` when building, and `development` when running the dev server) |
|
|
37
|
+
| `-e, --extends=<layer-name>` | | Extend from a Nuxt layer |
|
|
38
|
+
<!--/generate-opts-->
|
|
39
|
+
|
|
40
|
+
::read-more{to="/docs/3.x/getting-started/deployment#static-hosting"}
|
|
41
|
+
Read more about pre-rendering and static hosting.
|
|
42
|
+
::
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "nuxt info"
|
|
3
|
+
description: The info command logs information about the current or specified Nuxt project.
|
|
4
|
+
links:
|
|
5
|
+
- label: Source
|
|
6
|
+
icon: i-simple-icons-github
|
|
7
|
+
to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/info.ts
|
|
8
|
+
size: xs
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<!--info-cmd-->
|
|
12
|
+
```bash [Terminal]
|
|
13
|
+
npx nuxt info [ROOTDIR] [--cwd=<directory>]
|
|
14
|
+
```
|
|
15
|
+
<!--/info-cmd-->
|
|
16
|
+
|
|
17
|
+
The `info` command logs information about the current or specified Nuxt project.
|
|
18
|
+
|
|
19
|
+
## Arguments
|
|
20
|
+
|
|
21
|
+
<!--info-args-->
|
|
22
|
+
| Argument | Description |
|
|
23
|
+
|---------------|------------------------------------------------|
|
|
24
|
+
| `ROOTDIR="."` | Specifies the working directory (default: `.`) |
|
|
25
|
+
<!--/info-args-->
|
|
26
|
+
|
|
27
|
+
## Options
|
|
28
|
+
|
|
29
|
+
<!--info-opts-->
|
|
30
|
+
| Option | Default | Description |
|
|
31
|
+
|---------------------|---------|----------------------------------------------------------------------------------|
|
|
32
|
+
| `--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`) |
|
|
33
|
+
<!--/info-opts-->
|