@nuxt/docs 4.1.2 → 4.1.3
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 +6 -6
- package/1.getting-started/02.installation.md +2 -1
- package/1.getting-started/03.configuration.md +36 -36
- package/1.getting-started/04.views.md +9 -9
- package/1.getting-started/05.assets.md +15 -9
- package/1.getting-started/06.styling.md +58 -48
- package/1.getting-started/07.routing.md +17 -17
- package/1.getting-started/08.seo-meta.md +59 -46
- package/1.getting-started/09.transitions.md +49 -44
- package/1.getting-started/10.data-fetching.md +104 -81
- package/1.getting-started/11.state-management.md +26 -19
- package/1.getting-started/12.error-handling.md +22 -20
- package/1.getting-started/13.server.md +8 -8
- package/1.getting-started/14.layers.md +22 -16
- package/1.getting-started/15.prerendering.md +32 -32
- package/1.getting-started/16.deployment.md +10 -10
- package/1.getting-started/17.testing.md +44 -44
- package/1.getting-started/18.upgrade.md +53 -71
- package/2.guide/0.index.md +7 -7
- package/2.guide/{2.directory-structure → 1.directory-structure}/.navigation.yml +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/0.nuxt.md +3 -3
- package/2.guide/1.directory-structure/0.output.md +18 -0
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/.navigation.yml +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.assets.md +4 -4
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.components.md +45 -28
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.composables.md +13 -13
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.layouts.md +19 -15
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.middleware.md +31 -25
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.pages.md +39 -37
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.plugins.md +25 -25
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.utils.md +7 -7
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/3.app-config.md +18 -18
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/3.app.md +7 -7
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/3.error.md +6 -6
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.content.md +7 -4
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.modules.md +8 -8
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.node_modules.md +2 -2
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.public.md +2 -2
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.server.md +35 -35
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.shared.md +7 -7
- package/2.guide/{2.directory-structure → 1.directory-structure}/2.env.md +8 -8
- package/2.guide/{2.directory-structure → 1.directory-structure}/2.gitignore.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/2.nuxtignore.md +5 -4
- package/2.guide/{2.directory-structure → 1.directory-structure}/2.nuxtrc.md +4 -4
- package/2.guide/{2.directory-structure → 1.directory-structure}/3.nuxt-config.md +3 -3
- package/2.guide/{2.directory-structure → 1.directory-structure}/3.package.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/3.tsconfig.md +3 -3
- package/2.guide/{1.concepts → 2.concepts}/1.auto-imports.md +22 -22
- package/2.guide/{1.concepts → 2.concepts}/10.nuxt-lifecycle.md +17 -17
- package/2.guide/{1.concepts → 2.concepts}/2.vuejs-development.md +13 -13
- package/2.guide/{1.concepts → 2.concepts}/3.rendering.md +24 -22
- package/2.guide/{1.concepts → 2.concepts}/4.server-engine.md +6 -6
- package/2.guide/{1.concepts → 2.concepts}/5.modules.md +5 -5
- package/2.guide/{1.concepts → 2.concepts}/7.esm.md +17 -15
- package/2.guide/{1.concepts → 2.concepts}/8.typescript.md +12 -12
- package/2.guide/3.going-further/1.events.md +3 -3
- package/2.guide/3.going-further/1.experimental-features.md +246 -85
- package/2.guide/3.going-further/1.features.md +44 -9
- package/2.guide/3.going-further/1.internals.md +25 -25
- package/2.guide/3.going-further/10.runtime-config.md +12 -12
- package/2.guide/3.going-further/11.nightly-release-channel.md +1 -1
- package/2.guide/3.going-further/2.hooks.md +14 -14
- package/2.guide/3.going-further/3.modules.md +96 -94
- package/2.guide/3.going-further/4.kit.md +7 -7
- package/2.guide/3.going-further/6.nuxt-app.md +8 -8
- package/2.guide/3.going-further/7.layers.md +62 -53
- package/2.guide/3.going-further/9.debugging.md +2 -2
- package/2.guide/4.recipes/1.custom-routing.md +30 -30
- package/2.guide/4.recipes/2.vite-plugin.md +4 -4
- package/2.guide/4.recipes/3.custom-usefetch.md +13 -13
- package/2.guide/4.recipes/4.sessions-and-authentication.md +35 -21
- package/2.guide/5.best-practices/hydration.md +4 -4
- package/2.guide/5.best-practices/performance.md +17 -17
- package/3.api/1.components/1.client-only.md +6 -3
- package/3.api/1.components/1.nuxt-client-fallback.md +10 -7
- package/3.api/1.components/10.nuxt-picture.md +1 -1
- package/3.api/1.components/11.teleports.md +5 -2
- package/3.api/1.components/12.nuxt-route-announcer.md +9 -9
- package/3.api/1.components/13.nuxt-time.md +44 -17
- package/3.api/1.components/2.nuxt-page.md +6 -6
- package/3.api/1.components/3.nuxt-layout.md +15 -10
- package/3.api/1.components/4.nuxt-link.md +42 -22
- package/3.api/1.components/5.nuxt-loading-indicator.md +3 -3
- package/3.api/1.components/6.nuxt-error-boundary.md +12 -10
- package/3.api/2.composables/on-prehydrate.md +2 -2
- package/3.api/2.composables/use-app-config.md +1 -1
- package/3.api/2.composables/use-async-data.md +20 -20
- package/3.api/2.composables/use-cookie.md +29 -21
- package/3.api/2.composables/use-error.md +2 -2
- package/3.api/2.composables/use-fetch.md +58 -32
- package/3.api/2.composables/use-head-safe.md +7 -7
- package/3.api/2.composables/use-head.md +5 -5
- package/3.api/2.composables/use-hydration.md +6 -6
- package/3.api/2.composables/use-lazy-async-data.md +4 -4
- package/3.api/2.composables/use-lazy-fetch.md +4 -4
- package/3.api/2.composables/use-loading-indicator.md +12 -12
- package/3.api/2.composables/use-nuxt-app.md +22 -22
- package/3.api/2.composables/use-nuxt-data.md +8 -8
- package/3.api/2.composables/use-preview-mode.md +15 -18
- package/3.api/2.composables/use-request-event.md +1 -1
- package/3.api/2.composables/use-request-fetch.md +3 -3
- package/3.api/2.composables/use-request-header.md +1 -1
- package/3.api/2.composables/use-request-headers.md +4 -4
- package/3.api/2.composables/use-request-url.md +1 -1
- package/3.api/2.composables/use-response-header.md +9 -10
- package/3.api/2.composables/use-route-announcer.md +4 -4
- package/3.api/2.composables/use-route.md +1 -1
- package/3.api/2.composables/use-router.md +10 -8
- package/3.api/2.composables/use-runtime-config.md +11 -11
- package/3.api/2.composables/use-runtime-hook.md +2 -2
- package/3.api/2.composables/use-seo-meta.md +4 -4
- package/3.api/2.composables/use-server-seo-meta.md +6 -6
- package/3.api/2.composables/use-state.md +5 -5
- package/3.api/3.utils/$fetch.md +10 -8
- package/3.api/3.utils/abort-navigation.md +3 -3
- package/3.api/3.utils/add-route-middleware.md +5 -5
- package/3.api/3.utils/call-once.md +6 -6
- package/3.api/3.utils/clear-error.md +3 -3
- package/3.api/3.utils/clear-nuxt-data.md +3 -3
- package/3.api/3.utils/clear-nuxt-state.md +3 -3
- package/3.api/3.utils/create-error.md +2 -2
- package/3.api/3.utils/define-lazy-hydration-component.md +13 -13
- package/3.api/3.utils/define-nuxt-component.md +5 -5
- package/3.api/3.utils/define-nuxt-plugin.md +13 -13
- package/3.api/3.utils/define-nuxt-route-middleware.md +5 -5
- package/3.api/3.utils/define-page-meta.md +23 -23
- package/3.api/3.utils/define-route-rules.md +7 -7
- package/3.api/3.utils/navigate-to.md +11 -11
- package/3.api/3.utils/prefetch-components.md +1 -1
- package/3.api/3.utils/preload-components.md +1 -1
- package/3.api/3.utils/preload-route-components.md +2 -2
- package/3.api/3.utils/prerender-routes.md +3 -3
- package/3.api/3.utils/refresh-cookie.md +4 -4
- package/3.api/3.utils/refresh-nuxt-data.md +12 -7
- package/3.api/3.utils/reload-nuxt-app.md +3 -3
- package/3.api/3.utils/set-page-layout.md +1 -1
- package/3.api/3.utils/set-response-status.md +3 -3
- package/3.api/3.utils/show-error.md +5 -5
- package/3.api/3.utils/update-app-config.md +4 -3
- package/3.api/4.commands/add.md +1 -1
- package/3.api/4.commands/analyze.md +2 -1
- package/3.api/4.commands/build.md +2 -1
- package/3.api/4.commands/dev.md +5 -4
- package/3.api/4.commands/generate.md +3 -2
- package/3.api/4.commands/init.md +3 -2
- package/3.api/4.commands/module.md +4 -4
- package/3.api/4.commands/prepare.md +7 -2
- package/3.api/4.commands/preview.md +5 -4
- package/3.api/4.commands/test.md +40 -0
- package/3.api/4.commands/typecheck.md +5 -3
- package/3.api/4.commands/upgrade.md +3 -3
- package/3.api/5.kit/1.modules.md +36 -36
- package/3.api/5.kit/10.runtime-config.md +1 -1
- package/3.api/5.kit/10.templates.md +8 -6
- package/3.api/5.kit/11.nitro.md +62 -62
- package/3.api/5.kit/12.resolving.md +2 -2
- package/3.api/5.kit/14.builder.md +1 -0
- package/3.api/5.kit/15.examples.md +2 -2
- package/3.api/5.kit/16.layers.md +26 -26
- package/3.api/5.kit/3.compatibility.md +14 -14
- package/3.api/5.kit/4.autoimports.md +13 -13
- package/3.api/5.kit/5.components.md +7 -7
- package/3.api/5.kit/6.context.md +3 -3
- package/3.api/5.kit/7.pages.md +7 -7
- package/3.api/5.kit/8.layout.md +2 -2
- package/3.api/5.kit/9.plugins.md +5 -4
- package/3.api/6.advanced/1.hooks.md +3 -3
- package/3.api/6.advanced/2.import-meta.md +3 -3
- package/3.api/6.nuxt-config.md +300 -865
- package/3.api/index.md +7 -7
- package/5.community/2.getting-help.md +1 -1
- package/5.community/3.reporting-bugs.md +1 -1
- package/5.community/4.contribution.md +11 -11
- package/5.community/5.framework-contribution.md +4 -4
- package/5.community/6.roadmap.md +1 -1
- package/6.bridge/1.overview.md +13 -13
- package/6.bridge/10.configuration.md +2 -1
- package/6.bridge/2.typescript.md +3 -3
- package/6.bridge/3.bridge-composition-api.md +8 -8
- package/6.bridge/4.plugins-and-middleware.md +9 -9
- package/6.bridge/5.nuxt3-compatible-api.md +20 -17
- package/6.bridge/6.meta.md +20 -19
- package/6.bridge/7.runtime-config.md +1 -1
- package/6.bridge/8.nitro.md +3 -3
- package/6.bridge/9.vite.md +4 -4
- package/7.migration/1.overview.md +2 -2
- package/7.migration/10.bundling.md +1 -1
- package/7.migration/11.server.md +3 -3
- package/7.migration/2.configuration.md +23 -21
- package/7.migration/20.module-authors.md +7 -7
- package/7.migration/3.auto-imports.md +3 -3
- package/7.migration/4.meta.md +21 -18
- package/7.migration/5.plugins-and-middleware.md +8 -8
- package/7.migration/6.pages-and-layouts.md +28 -24
- package/7.migration/7.component-options.md +18 -18
- package/7.migration/8.runtime-config.md +7 -7
- package/package.json +1 -1
- package/2.guide/2.directory-structure/0.output.md +0 -18
- /package/2.guide/{1.concepts → 2.concepts}/.navigation.yml +0 -0
- /package/2.guide/{1.concepts → 2.concepts}/9.code-style.md +0 -0
|
@@ -8,25 +8,25 @@ links:
|
|
|
8
8
|
size: xs
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
`definePageMeta` is a compiler macro that you can use to set metadata for your **page** components located in the [`app/pages/`](/docs/guide/directory-structure/app/pages) directory (unless [set otherwise](/docs/api/nuxt-config#pages)). This way you can set custom metadata for each static or dynamic route of your Nuxt application.
|
|
11
|
+
`definePageMeta` is a compiler macro that you can use to set metadata for your **page** components located in the [`app/pages/`](/docs/4.x/guide/directory-structure/app/pages) directory (unless [set otherwise](/docs/4.x/api/nuxt-config#pages)). This way you can set custom metadata for each static or dynamic route of your Nuxt application.
|
|
12
12
|
|
|
13
13
|
```vue [app/pages/some-page.vue]
|
|
14
14
|
<script setup lang="ts">
|
|
15
15
|
definePageMeta({
|
|
16
|
-
layout: 'default'
|
|
16
|
+
layout: 'default',
|
|
17
17
|
})
|
|
18
18
|
</script>
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
:read-more{to="/docs/guide/directory-structure/app/pages#page-metadata"}
|
|
21
|
+
:read-more{to="/docs/4.x/guide/directory-structure/app/pages#page-metadata"}
|
|
22
22
|
|
|
23
23
|
## Type
|
|
24
24
|
|
|
25
|
-
```ts
|
|
26
|
-
definePageMeta(meta: PageMeta)
|
|
25
|
+
```ts [Signature]
|
|
26
|
+
export function definePageMeta (meta: PageMeta): void
|
|
27
27
|
|
|
28
28
|
interface PageMeta {
|
|
29
|
-
validate?: (route: RouteLocationNormalized) => boolean | Promise<boolean> | Partial<NuxtError> | Promise<Partial<NuxtError>>
|
|
29
|
+
validate?: ((route: RouteLocationNormalized) => boolean | Promise<boolean> | Partial<NuxtError> | Promise<Partial<NuxtError>>)
|
|
30
30
|
redirect?: RouteRecordRedirectOption
|
|
31
31
|
name?: string
|
|
32
32
|
path?: string
|
|
@@ -56,13 +56,13 @@ interface PageMeta {
|
|
|
56
56
|
|
|
57
57
|
- **Type**: `string`
|
|
58
58
|
|
|
59
|
-
You may define a name for this page's route. By default, name is generated based on path inside the [`app/pages/` directory](/docs/guide/directory-structure/app/pages).
|
|
59
|
+
You may define a name for this page's route. By default, name is generated based on path inside the [`app/pages/` directory](/docs/4.x/guide/directory-structure/app/pages).
|
|
60
60
|
|
|
61
61
|
**`path`**
|
|
62
62
|
|
|
63
63
|
- **Type**: `string`
|
|
64
64
|
|
|
65
|
-
You may define a [custom regular expression](#using-a-custom-regular-expression) if you have a more complex pattern than can be expressed with the file name.
|
|
65
|
+
You may define a [custom regular expression](/docs/4.x/api/composables/use-nuxt-app#using-a-custom-regular-expression) if you have a more complex pattern than can be expressed with the file name.
|
|
66
66
|
|
|
67
67
|
**`props`**
|
|
68
68
|
|
|
@@ -104,7 +104,7 @@ interface PageMeta {
|
|
|
104
104
|
|
|
105
105
|
- **Type**: `MiddlewareKey` | [`NavigationGuard`](https://router.vuejs.org/api/interfaces/NavigationGuard.html#navigationguard) | `Array<MiddlewareKey | NavigationGuard>`
|
|
106
106
|
|
|
107
|
-
Define anonymous or named middleware directly within `definePageMeta`. Learn more about [route middleware](/docs/guide/directory-structure/app/middleware).
|
|
107
|
+
Define anonymous or named middleware directly within `definePageMeta`. Learn more about [route middleware](/docs/4.x/guide/directory-structure/app/middleware).
|
|
108
108
|
|
|
109
109
|
**`pageTransition`**
|
|
110
110
|
|
|
@@ -116,7 +116,7 @@ interface PageMeta {
|
|
|
116
116
|
|
|
117
117
|
- **Type**: `boolean | 'always'`
|
|
118
118
|
|
|
119
|
-
**Experimental feature, only available when [enabled in your nuxt.config file](/docs/getting-started/transitions#view-transitions-api-experimental)**</br>
|
|
119
|
+
**Experimental feature, only available when [enabled in your nuxt.config file](/docs/4.x/getting-started/transitions#view-transitions-api-experimental)**</br>
|
|
120
120
|
Enable/disable View Transitions for the current page.
|
|
121
121
|
If set to true, Nuxt will not apply the transition if the users browser matches `prefers-reduced-motion: reduce` (recommended). If set to `always`, Nuxt will always apply the transition.
|
|
122
122
|
|
|
@@ -136,13 +136,13 @@ interface PageMeta {
|
|
|
136
136
|
|
|
137
137
|
- **Type**: `boolean | (to: RouteLocationNormalized, from: RouteLocationNormalized) => boolean`
|
|
138
138
|
|
|
139
|
-
Tell Nuxt to scroll to the top before rendering the page or not. If you want to overwrite the default scroll behavior of Nuxt, you can do so in `~/router.options.ts` (see [custom routing](/docs/guide/recipes/custom-routing#using-
|
|
139
|
+
Tell Nuxt to scroll to the top before rendering the page or not. If you want to overwrite the default scroll behavior of Nuxt, you can do so in `~/router.options.ts` (see [custom routing](/docs/4.x/guide/recipes/custom-routing#using-routeroptions)) for more info.
|
|
140
140
|
|
|
141
141
|
**`[key: string]`**
|
|
142
142
|
|
|
143
143
|
- **Type**: `any`
|
|
144
144
|
|
|
145
|
-
Apart from the above properties, you can also set **custom** metadata. You may wish to do so in a type-safe way by [augmenting the type of the `meta` object](/docs/guide/directory-structure/app/pages/#typing-custom-metadata).
|
|
145
|
+
Apart from the above properties, you can also set **custom** metadata. You may wish to do so in a type-safe way by [augmenting the type of the `meta` object](/docs/4.x/guide/directory-structure/app/pages/#typing-custom-metadata).
|
|
146
146
|
|
|
147
147
|
## Examples
|
|
148
148
|
|
|
@@ -157,13 +157,13 @@ The example below demonstrates:
|
|
|
157
157
|
```vue [app/pages/some-page.vue]
|
|
158
158
|
<script setup lang="ts">
|
|
159
159
|
definePageMeta({
|
|
160
|
-
key:
|
|
160
|
+
key: route => route.fullPath,
|
|
161
161
|
|
|
162
162
|
keepalive: {
|
|
163
|
-
exclude: ['modal']
|
|
163
|
+
exclude: ['modal'],
|
|
164
164
|
},
|
|
165
165
|
|
|
166
|
-
pageType: 'Checkout'
|
|
166
|
+
pageType: 'Checkout',
|
|
167
167
|
})
|
|
168
168
|
</script>
|
|
169
169
|
```
|
|
@@ -181,20 +181,20 @@ definePageMeta({
|
|
|
181
181
|
const auth = useState('auth')
|
|
182
182
|
|
|
183
183
|
if (!auth.value.authenticated) {
|
|
184
|
-
|
|
184
|
+
return navigateTo('/login')
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
if (to.path !== '/checkout') {
|
|
188
188
|
return navigateTo('/checkout')
|
|
189
189
|
}
|
|
190
|
-
}
|
|
190
|
+
},
|
|
191
191
|
],
|
|
192
192
|
|
|
193
193
|
// ... or a string
|
|
194
|
-
middleware: 'auth'
|
|
194
|
+
middleware: 'auth',
|
|
195
195
|
|
|
196
196
|
// ... or multiple strings
|
|
197
|
-
middleware: ['auth', 'another-named-middleware']
|
|
197
|
+
middleware: ['auth', 'another-named-middleware'],
|
|
198
198
|
})
|
|
199
199
|
</script>
|
|
200
200
|
```
|
|
@@ -210,7 +210,7 @@ To make sure that we are only matching digits (`\d+`) for `postId` in the `[post
|
|
|
210
210
|
```vue [app/pages/[postId\\]-[postSlug\\].vue]
|
|
211
211
|
<script setup lang="ts">
|
|
212
212
|
definePageMeta({
|
|
213
|
-
path: '/:postId(\\d+)-:postSlug'
|
|
213
|
+
path: '/:postId(\\d+)-:postSlug',
|
|
214
214
|
})
|
|
215
215
|
</script>
|
|
216
216
|
```
|
|
@@ -219,16 +219,16 @@ For more examples see [Vue Router's Matching Syntax](https://router.vuejs.org/gu
|
|
|
219
219
|
|
|
220
220
|
### Defining Layout
|
|
221
221
|
|
|
222
|
-
You can define the layout that matches the layout's file name located (by default) in the [`app/layouts/` directory](/docs/guide/directory-structure/app/layouts). You can also disable the layout by setting the `layout` to `false`:
|
|
222
|
+
You can define the layout that matches the layout's file name located (by default) in the [`app/layouts/` directory](/docs/4.x/guide/directory-structure/app/layouts). You can also disable the layout by setting the `layout` to `false`:
|
|
223
223
|
|
|
224
224
|
```vue [app/pages/some-page.vue]
|
|
225
225
|
<script setup lang="ts">
|
|
226
226
|
definePageMeta({
|
|
227
227
|
// set custom layout
|
|
228
|
-
layout: 'admin'
|
|
228
|
+
layout: 'admin',
|
|
229
229
|
|
|
230
230
|
// ... or disable a default layout
|
|
231
|
-
layout: false
|
|
231
|
+
layout: false,
|
|
232
232
|
})
|
|
233
233
|
</script>
|
|
234
234
|
```
|
|
@@ -8,7 +8,7 @@ links:
|
|
|
8
8
|
size: xs
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
::read-more{to="/docs/guide/going-further/experimental-features#inlinerouterules" icon="i-lucide-star"}
|
|
11
|
+
::read-more{to="/docs/4.x/guide/going-further/experimental-features#inlinerouterules" icon="i-lucide-star"}
|
|
12
12
|
This feature is experimental and in order to use it you must enable the `experimental.inlineRouteRules` option in your `nuxt.config`.
|
|
13
13
|
::
|
|
14
14
|
|
|
@@ -17,7 +17,7 @@ This feature is experimental and in order to use it you must enable the `experim
|
|
|
17
17
|
```vue [app/pages/index.vue]
|
|
18
18
|
<script setup lang="ts">
|
|
19
19
|
defineRouteRules({
|
|
20
|
-
prerender: true
|
|
20
|
+
prerender: true,
|
|
21
21
|
})
|
|
22
22
|
</script>
|
|
23
23
|
|
|
@@ -31,13 +31,13 @@ Will be translated to:
|
|
|
31
31
|
```ts [nuxt.config.ts]
|
|
32
32
|
export default defineNuxtConfig({
|
|
33
33
|
routeRules: {
|
|
34
|
-
'/': { prerender: true }
|
|
35
|
-
}
|
|
34
|
+
'/': { prerender: true },
|
|
35
|
+
},
|
|
36
36
|
})
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
::note
|
|
40
|
-
When running [`nuxt build`](/docs/api/commands/build), the home page will be pre-rendered in `.output/public/index.html` and statically served.
|
|
40
|
+
When running [`nuxt build`](/docs/4.x/api/commands/build), the home page will be pre-rendered in `.output/public/index.html` and statically served.
|
|
41
41
|
::
|
|
42
42
|
|
|
43
43
|
## Notes
|
|
@@ -45,8 +45,8 @@ When running [`nuxt build`](/docs/api/commands/build), the home page will be pre
|
|
|
45
45
|
- A rule defined in `~/pages/foo/bar.vue` will be applied to `/foo/bar` requests.
|
|
46
46
|
- A rule in `~/pages/foo/[id].vue` will be applied to `/foo/**` requests.
|
|
47
47
|
|
|
48
|
-
For more control, such as if you are using a custom `path` or `alias` set in the page's [`definePageMeta`](/docs/api/utils/define-page-meta), you should set `routeRules` directly within your `nuxt.config`.
|
|
48
|
+
For more control, such as if you are using a custom `path` or `alias` set in the page's [`definePageMeta`](/docs/4.x/api/utils/define-page-meta), you should set `routeRules` directly within your `nuxt.config`.
|
|
49
49
|
|
|
50
|
-
::read-more{to="/docs/guide/concepts/rendering#hybrid-rendering" icon="i-lucide-medal"}
|
|
50
|
+
::read-more{to="/docs/4.x/guide/concepts/rendering#hybrid-rendering" icon="i-lucide-medal"}
|
|
51
51
|
Read more about the `routeRules`.
|
|
52
52
|
::
|
|
@@ -10,7 +10,7 @@ links:
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
-
`navigateTo` is available on both server side and client side. It can be used within the [Nuxt context](/docs/guide/going-further/nuxt-app#the-nuxt-context), or directly, to perform page navigation.
|
|
13
|
+
`navigateTo` is available on both server side and client side. It can be used within the [Nuxt context](/docs/4.x/guide/going-further/nuxt-app#the-nuxt-context), or directly, to perform page navigation.
|
|
14
14
|
|
|
15
15
|
::warning
|
|
16
16
|
Make sure to always use `await` or `return` on result of `navigateTo` when calling it.
|
|
@@ -35,8 +35,8 @@ await navigateTo({
|
|
|
35
35
|
path: '/search',
|
|
36
36
|
query: {
|
|
37
37
|
page: 1,
|
|
38
|
-
sort: 'asc'
|
|
39
|
-
}
|
|
38
|
+
sort: 'asc',
|
|
39
|
+
},
|
|
40
40
|
})
|
|
41
41
|
</script>
|
|
42
42
|
```
|
|
@@ -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/guide/directory-structure/app/middleware"}
|
|
71
|
+
:read-more{to="/docs/4.x/guide/directory-structure/app/middleware"}
|
|
72
72
|
|
|
73
73
|
### Navigating to an External URL
|
|
74
74
|
|
|
@@ -92,7 +92,7 @@ await navigateTo('https://nuxt.com')
|
|
|
92
92
|
|
|
93
93
|
// will redirect successfully with the 'external' parameter set to 'true'
|
|
94
94
|
await navigateTo('https://nuxt.com', {
|
|
95
|
-
external: true
|
|
95
|
+
external: true,
|
|
96
96
|
})
|
|
97
97
|
</script>
|
|
98
98
|
```
|
|
@@ -107,20 +107,20 @@ await navigateTo('https://nuxt.com', {
|
|
|
107
107
|
target: '_blank',
|
|
108
108
|
windowFeatures: {
|
|
109
109
|
width: 500,
|
|
110
|
-
height: 500
|
|
111
|
-
}
|
|
112
|
-
}
|
|
110
|
+
height: 500,
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
113
|
})
|
|
114
114
|
</script>
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
## Type
|
|
118
118
|
|
|
119
|
-
```ts
|
|
120
|
-
function navigateTo(
|
|
119
|
+
```ts [Signature]
|
|
120
|
+
export function navigateTo (
|
|
121
121
|
to: RouteLocationRaw | undefined | null,
|
|
122
122
|
options?: NavigateToOptions
|
|
123
|
-
)
|
|
123
|
+
): Promise<void | NavigationFailure | false> | false | void | RouteLocationRaw
|
|
124
124
|
|
|
125
125
|
interface NavigateToOptions {
|
|
126
126
|
replace?: boolean
|
|
@@ -20,7 +20,7 @@ await prefetchComponents(['MyGlobalComponent1', 'MyGlobalComponent2'])
|
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
::note
|
|
23
|
-
Current implementation behaves exactly the same as [`preloadComponents`](/docs/api/utils/preload-components) by preloading components instead of just prefetching we are working to improve this behavior.
|
|
23
|
+
Current implementation behaves exactly the same as [`preloadComponents`](/docs/4.x/api/utils/preload-components) by preloading components instead of just prefetching we are working to improve this behavior.
|
|
24
24
|
::
|
|
25
25
|
|
|
26
26
|
::note
|
|
@@ -12,7 +12,7 @@ Preloading components loads components that your page will need very soon, which
|
|
|
12
12
|
|
|
13
13
|
Use `preloadComponents` to manually preload individual components that have been registered globally in your Nuxt app. By default Nuxt registers these as async components. You must use the Pascal-cased version of the component name.
|
|
14
14
|
|
|
15
|
-
```
|
|
15
|
+
```ts
|
|
16
16
|
await preloadComponents('MyGlobalComponent')
|
|
17
17
|
|
|
18
18
|
await preloadComponents(['MyGlobalComponent1', 'MyGlobalComponent2'])
|
|
@@ -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/4.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/4.x/api/utils/navigate-to"}
|
|
38
38
|
|
|
39
39
|
::note
|
|
40
40
|
On server, `preloadRouteComponents` will have no effect.
|
|
@@ -11,14 +11,14 @@ links:
|
|
|
11
11
|
When prerendering, you can hint to Nitro to prerender additional paths, even if their URLs do not show up in the HTML of the generated page.
|
|
12
12
|
|
|
13
13
|
::important
|
|
14
|
-
`prerenderRoutes` can only be called within the [Nuxt context](/docs/guide/going-further/nuxt-app#the-nuxt-context).
|
|
14
|
+
`prerenderRoutes` can only be called within the [Nuxt context](/docs/4.x/guide/going-further/nuxt-app#the-nuxt-context).
|
|
15
15
|
::
|
|
16
16
|
|
|
17
17
|
::note
|
|
18
18
|
`prerenderRoutes` has to be executed during prerendering. If the `prerenderRoutes` is used in dynamic pages/routes which are not prerendered, then it will not be executed.
|
|
19
19
|
::
|
|
20
20
|
|
|
21
|
-
```
|
|
21
|
+
```ts
|
|
22
22
|
const route = useRoute()
|
|
23
23
|
|
|
24
24
|
prerenderRoutes('/')
|
|
@@ -31,7 +31,7 @@ In the browser, or if called outside prerendering, `prerenderRoutes` will have n
|
|
|
31
31
|
|
|
32
32
|
You can even prerender API routes which is particularly useful for full statically generated sites (SSG) because you can then `$fetch` data as if you have an available server!
|
|
33
33
|
|
|
34
|
-
```
|
|
34
|
+
```ts
|
|
35
35
|
prerenderRoutes('/api/content/article/name-of-article')
|
|
36
36
|
|
|
37
37
|
// Somewhere later in App
|
|
@@ -27,7 +27,7 @@ This is useful for updating the `useCookie` ref when we know the new cookie valu
|
|
|
27
27
|
const tokenCookie = useCookie('token')
|
|
28
28
|
|
|
29
29
|
const login = async (username, password) => {
|
|
30
|
-
const token = await $fetch('/api/token', { ... }) // Sets `token` cookie on response
|
|
30
|
+
const token = await $fetch('/api/token', { /** ... */ }) // Sets `token` cookie on response
|
|
31
31
|
refreshCookie('token')
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -35,12 +35,12 @@ const loggedIn = computed(() => !!tokenCookie.value)
|
|
|
35
35
|
</script>
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
::note{to="/docs/guide/going-further/experimental-features#cookiestore"}
|
|
38
|
+
::note{to="/docs/4.x/guide/going-further/experimental-features#cookiestore"}
|
|
39
39
|
You can enable experimental `cookieStore` option to automatically refresh `useCookie` value when cookie changes in the browser.
|
|
40
40
|
::
|
|
41
41
|
|
|
42
42
|
## Type
|
|
43
43
|
|
|
44
|
-
```ts
|
|
45
|
-
refreshCookie(name: string): void
|
|
44
|
+
```ts [Signature]
|
|
45
|
+
export function refreshCookie (name: string): void
|
|
46
46
|
```
|
|
@@ -8,7 +8,7 @@ links:
|
|
|
8
8
|
size: xs
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
`refreshNuxtData` is used to refetch all or specific `asyncData` instances, including those from [`useAsyncData`](/docs/api/composables/use-async-data), [`useLazyAsyncData`](/docs/api/composables/use-lazy-async-data), [`useFetch`](/docs/api/composables/use-fetch), and [`useLazyFetch`](/docs/api/composables/use-lazy-fetch).
|
|
11
|
+
`refreshNuxtData` is used to refetch all or specific `asyncData` instances, including those from [`useAsyncData`](/docs/4.x/api/composables/use-async-data), [`useLazyAsyncData`](/docs/4.x/api/composables/use-lazy-async-data), [`useFetch`](/docs/4.x/api/composables/use-fetch), and [`useLazyFetch`](/docs/4.x/api/composables/use-lazy-fetch).
|
|
12
12
|
|
|
13
13
|
::note
|
|
14
14
|
If your component is cached by `<KeepAlive>` and enters a deactivated state, the `asyncData` inside the component will still be refetched until the component is unmounted.
|
|
@@ -16,13 +16,13 @@ If your component is cached by `<KeepAlive>` and enters a deactivated state, the
|
|
|
16
16
|
|
|
17
17
|
## Type
|
|
18
18
|
|
|
19
|
-
```ts
|
|
20
|
-
refreshNuxtData(keys?: string | string[])
|
|
19
|
+
```ts [Signature]
|
|
20
|
+
export function refreshNuxtData (keys?: string | string[])
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Parameters
|
|
24
24
|
|
|
25
|
-
* `keys`: A single string or an array of strings as `keys` that are used to fetch the data. This parameter is **optional**. All [`useAsyncData`](/docs/api/composables/use-async-data) and [`useFetch`](/docs/api/composables/use-fetch) keys are re-fetched when no `keys` are explicitly specified.
|
|
25
|
+
* `keys`: A single string or an array of strings as `keys` that are used to fetch the data. This parameter is **optional**. All [`useAsyncData`](/docs/4.x/api/composables/use-async-data) and [`useFetch`](/docs/4.x/api/composables/use-fetch) keys are re-fetched when no `keys` are explicitly specified.
|
|
26
26
|
|
|
27
27
|
## Return Values
|
|
28
28
|
|
|
@@ -50,7 +50,10 @@ async function refreshAll () {
|
|
|
50
50
|
|
|
51
51
|
<template>
|
|
52
52
|
<div>
|
|
53
|
-
<button
|
|
53
|
+
<button
|
|
54
|
+
:disabled="refreshing"
|
|
55
|
+
@click="refreshAll"
|
|
56
|
+
>
|
|
54
57
|
Refetch All Data
|
|
55
58
|
</button>
|
|
56
59
|
</div>
|
|
@@ -80,7 +83,9 @@ async function refresh () {
|
|
|
80
83
|
<div v-if="refreshing">
|
|
81
84
|
Loading
|
|
82
85
|
</div>
|
|
83
|
-
<button @click="refresh">
|
|
86
|
+
<button @click="refresh">
|
|
87
|
+
Refresh
|
|
88
|
+
</button>
|
|
84
89
|
</template>
|
|
85
90
|
```
|
|
86
91
|
|
|
@@ -88,4 +93,4 @@ async function refresh () {
|
|
|
88
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.
|
|
89
94
|
::
|
|
90
95
|
|
|
91
|
-
:read-more{to="/docs/getting-started/data-fetching"}
|
|
96
|
+
:read-more{to="/docs/4.x/getting-started/data-fetching"}
|
|
@@ -14,14 +14,14 @@ 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/4.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
|
|
|
21
21
|
## Type
|
|
22
22
|
|
|
23
|
-
```ts
|
|
24
|
-
reloadNuxtApp(options?: ReloadNuxtAppOptions)
|
|
23
|
+
```ts [Signature]
|
|
24
|
+
export function reloadNuxtApp (options?: ReloadNuxtAppOptions)
|
|
25
25
|
|
|
26
26
|
interface ReloadNuxtAppOptions {
|
|
27
27
|
ttl?: number
|
|
@@ -9,7 +9,7 @@ links:
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
::important
|
|
12
|
-
`setPageLayout` allows you to dynamically change the layout of a page. It relies on access to the Nuxt context and therefore can only be called within the [Nuxt context](/docs/guide/going-further/nuxt-app#the-nuxt-context).
|
|
12
|
+
`setPageLayout` allows you to dynamically change the layout of a page. It relies on access to the Nuxt context and therefore can only be called within the [Nuxt context](/docs/4.x/guide/going-further/nuxt-app#the-nuxt-context).
|
|
13
13
|
::
|
|
14
14
|
|
|
15
15
|
```ts [app/middleware/custom-layout.ts]
|
|
@@ -13,10 +13,10 @@ Nuxt provides composables and utilities for first-class server-side-rendering su
|
|
|
13
13
|
`setResponseStatus` sets the statusCode (and optionally the statusMessage) of the response.
|
|
14
14
|
|
|
15
15
|
::important
|
|
16
|
-
`setResponseStatus` can only be called in the [Nuxt context](/docs/guide/going-further/nuxt-app#the-nuxt-context).
|
|
16
|
+
`setResponseStatus` can only be called in the [Nuxt context](/docs/4.x/guide/going-further/nuxt-app#the-nuxt-context).
|
|
17
17
|
::
|
|
18
18
|
|
|
19
|
-
```
|
|
19
|
+
```ts
|
|
20
20
|
const event = useRequestEvent()
|
|
21
21
|
|
|
22
22
|
// event will be undefined in the browser
|
|
@@ -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/4.x/getting-started/error-handling"}
|
|
@@ -8,24 +8,24 @@ links:
|
|
|
8
8
|
size: xs
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
Within the [Nuxt context](/docs/guide/going-further/nuxt-app#the-nuxt-context) you can use `showError` to show an error.
|
|
11
|
+
Within the [Nuxt context](/docs/4.x/guide/going-further/nuxt-app#the-nuxt-context) you can use `showError` to show an error.
|
|
12
12
|
|
|
13
13
|
**Parameters:**
|
|
14
14
|
|
|
15
15
|
- `error`: `string | Error | Partial<{ cause, data, message, name, stack, statusCode, statusMessage }>`
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
|
-
showError(
|
|
18
|
+
showError('😱 Oh no, an error has been thrown.')
|
|
19
19
|
showError({
|
|
20
20
|
statusCode: 404,
|
|
21
|
-
statusMessage:
|
|
21
|
+
statusMessage: 'Page Not Found',
|
|
22
22
|
})
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
The error is set in the state using [`useError()`](/docs/api/composables/use-error) to create a reactive and SSR-friendly shared error state across components.
|
|
25
|
+
The error is set in the state using [`useError()`](/docs/4.x/api/composables/use-error) to create a reactive and SSR-friendly shared error state across components.
|
|
26
26
|
|
|
27
27
|
::tip
|
|
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/4.x/getting-started/error-handling"}
|
|
@@ -9,19 +9,20 @@ links:
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
::note
|
|
12
|
-
Updates the [`app.config`](/docs/guide/directory-structure/app-config) using deep assignment. Existing (nested) properties will be preserved.
|
|
12
|
+
Updates the [`app.config`](/docs/4.x/guide/directory-structure/app-config) using deep assignment. Existing (nested) properties will be preserved.
|
|
13
13
|
::
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
17
|
```js
|
|
18
|
+
import { updateAppConfig, useAppConfig } from '#imports'
|
|
19
|
+
|
|
18
20
|
const appConfig = useAppConfig() // { foo: 'bar' }
|
|
19
21
|
|
|
20
22
|
const newAppConfig = { foo: 'baz' }
|
|
21
|
-
|
|
22
23
|
updateAppConfig(newAppConfig)
|
|
23
24
|
|
|
24
25
|
console.log(appConfig) // { foo: 'baz' }
|
|
25
26
|
```
|
|
26
27
|
|
|
27
|
-
:read-more{to="/docs/guide/directory-structure/app-config"}
|
|
28
|
+
:read-more{to="/docs/4.x/guide/directory-structure/app-config"}
|
package/3.api/4.commands/add.md
CHANGED
|
@@ -19,7 +19,7 @@ npx nuxt add <TEMPLATE> <NAME> [--cwd=<directory>] [--logLevel=<silent|info|verb
|
|
|
19
19
|
<!--add-args-->
|
|
20
20
|
Argument | Description
|
|
21
21
|
--- | ---
|
|
22
|
-
`TEMPLATE` | Specify which template to generate (options: <api\|
|
|
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
23
|
`NAME` | Specify name of the generated file
|
|
24
24
|
<!--/add-args-->
|
|
25
25
|
|
|
@@ -10,7 +10,7 @@ links:
|
|
|
10
10
|
|
|
11
11
|
<!--analyze-cmd-->
|
|
12
12
|
```bash [Terminal]
|
|
13
|
-
npx nuxt analyze [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--dotenv] [--name=<name>] [--no-serve]
|
|
13
|
+
npx nuxt analyze [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--dotenv] [-e, --extends=<layer-name>] [--name=<name>] [--no-serve]
|
|
14
14
|
```
|
|
15
15
|
<!--/analyze-cmd-->
|
|
16
16
|
|
|
@@ -32,6 +32,7 @@ Option | Default | Description
|
|
|
32
32
|
`--cwd=<directory>` | | Specify the working directory, this takes precedence over ROOTDIR (default: `.`)
|
|
33
33
|
`--logLevel=<silent\|info\|verbose>` | | Specify build-time log level
|
|
34
34
|
`--dotenv` | | Path to `.env` file to load, relative to the root directory
|
|
35
|
+
`-e, --extends=<layer-name>` | | Extend from a Nuxt layer
|
|
35
36
|
`--name=<name>` | `default` | Name of the analysis
|
|
36
37
|
`--no-serve` | | Skip serving the analysis results
|
|
37
38
|
<!--/analyze-opts-->
|
|
@@ -10,7 +10,7 @@ links:
|
|
|
10
10
|
|
|
11
11
|
<!--build-cmd-->
|
|
12
12
|
```bash [Terminal]
|
|
13
|
-
npx nuxt build [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--prerender] [--preset] [--dotenv] [--envName]
|
|
13
|
+
npx nuxt build [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--prerender] [--preset] [--dotenv] [--envName] [-e, --extends=<layer-name>]
|
|
14
14
|
```
|
|
15
15
|
<!--/build-cmd-->
|
|
16
16
|
|
|
@@ -35,6 +35,7 @@ Option | Default | Description
|
|
|
35
35
|
`--preset` | | Nitro server preset
|
|
36
36
|
`--dotenv` | | Path to `.env` file to load, relative to the root directory
|
|
37
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
|
|
38
39
|
<!--/build-opts-->
|
|
39
40
|
|
|
40
41
|
::note
|
package/3.api/4.commands/dev.md
CHANGED
|
@@ -10,7 +10,7 @@ links:
|
|
|
10
10
|
|
|
11
11
|
<!--dev-cmd-->
|
|
12
12
|
```bash [Terminal]
|
|
13
|
-
npx nuxt dev [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--dotenv] [--envName] [--
|
|
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
14
|
```
|
|
15
15
|
<!--/dev-cmd-->
|
|
16
16
|
|
|
@@ -33,10 +33,11 @@ Option | Default | Description
|
|
|
33
33
|
`--logLevel=<silent\|info\|verbose>` | | Specify build-time log level
|
|
34
34
|
`--dotenv` | | Path to `.env` file to load, relative to the root directory
|
|
35
35
|
`--envName` | | The environment to use when resolving configuration overrides (default is `production` when building, and `development` when running the dev server)
|
|
36
|
-
|
|
37
|
-
`--
|
|
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
|
|
38
39
|
`-p, --port` | | Port to listen on (default: `NUXT_PORT \|\| NITRO_PORT \|\| PORT \|\| nuxtOptions.devServer.port`)
|
|
39
|
-
`-h, --host` | | Host to listen on (default: `NUXT_HOST \|\| NITRO_HOST \|\| HOST \|\| nuxtOptions.
|
|
40
|
+
`-h, --host` | | Host to listen on (default: `NUXT_HOST \|\| NITRO_HOST \|\| HOST \|\| nuxtOptions.devServer?.host`)
|
|
40
41
|
`--clipboard` | `false` | Copy the URL to the clipboard
|
|
41
42
|
`-o, --open` | `false` | Open the URL in the browser
|
|
42
43
|
`--https` | | Enable HTTPS
|
|
@@ -10,7 +10,7 @@ links:
|
|
|
10
10
|
|
|
11
11
|
<!--generate-cmd-->
|
|
12
12
|
```bash [Terminal]
|
|
13
|
-
npx nuxt generate [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--preset] [--dotenv] [--envName]
|
|
13
|
+
npx nuxt generate [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [--preset] [--dotenv] [--envName] [-e, --extends=<layer-name>]
|
|
14
14
|
```
|
|
15
15
|
<!--/generate-cmd-->
|
|
16
16
|
|
|
@@ -34,8 +34,9 @@ Option | Default | Description
|
|
|
34
34
|
`--preset` | | Nitro server preset
|
|
35
35
|
`--dotenv` | | Path to `.env` file to load, relative to the root directory
|
|
36
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
|
|
37
38
|
<!--/generate-opts-->
|
|
38
39
|
|
|
39
|
-
::read-more{to="/docs/getting-started/deployment#static-hosting"}
|
|
40
|
+
::read-more{to="/docs/4.x/getting-started/deployment#static-hosting"}
|
|
40
41
|
Read more about pre-rendering and static hosting.
|
|
41
42
|
::
|
package/3.api/4.commands/init.md
CHANGED
|
@@ -10,7 +10,7 @@ links:
|
|
|
10
10
|
|
|
11
11
|
<!--init-cmd-->
|
|
12
12
|
```bash [Terminal]
|
|
13
|
-
npm create nuxt@latest [DIR] [--cwd=<directory>] [-t, --template] [-f, --force] [--offline] [--preferOffline] [--no-install] [--gitInit] [--shell] [--packageManager] [--nightly]
|
|
13
|
+
npm create nuxt@latest [DIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [-t, --template] [-f, --force] [--offline] [--preferOffline] [--no-install] [--gitInit] [--shell] [--packageManager] [-M, --modules] [--no-modules] [--nightly]
|
|
14
14
|
```
|
|
15
15
|
<!--/init-cmd-->
|
|
16
16
|
|
|
@@ -30,6 +30,7 @@ Argument | Description
|
|
|
30
30
|
Option | Default | Description
|
|
31
31
|
--- | --- | ---
|
|
32
32
|
`--cwd=<directory>` | `.` | Specify the working directory
|
|
33
|
+
`--logLevel=<silent\|info\|verbose>` | | Specify build-time log level
|
|
33
34
|
`-t, --template` | | Template name
|
|
34
35
|
`-f, --force` | | Override existing directory
|
|
35
36
|
`--offline` | | Force offline mode
|
|
@@ -38,7 +39,7 @@ Option | Default | Description
|
|
|
38
39
|
`--gitInit` | | Initialize git repository
|
|
39
40
|
`--shell` | | Start shell after installation in project directory
|
|
40
41
|
`--packageManager` | | Package manager choice (npm, pnpm, yarn, bun)
|
|
41
|
-
|
|
42
|
+
`-M, --modules` | | Nuxt modules to install (comma separated without spaces)
|
|
42
43
|
`--no-modules` | | Skip module installation prompt
|
|
43
44
|
`--nightly` | | Use Nuxt nightly release channel (3x or latest)
|
|
44
45
|
<!--/init-opts-->
|