@nuxt/docs-nightly 4.4.7-29673476.91186dc5 → 4.4.8-29682245.e6d578fe

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.
@@ -241,7 +241,7 @@ Read more about `useAsyncData`.
241
241
  By default, Nuxt waits until a `refresh` is finished before it can be executed again.
242
242
 
243
243
  ::note
244
- If you have not fetched data on the server (for example, with `server: false`), then the data _will not_ be fetched until hydration completes. This means even if you await `useFetch` on client-side, `data` will remain null within `<script setup>`.
244
+ If you have not fetched data on the server (for example, with `server: false`), then the data _will not_ be fetched until hydration completes. This means even if you await `useFetch` on client-side, `data` will remain undefined within `<script setup>`.
245
245
  ::
246
246
 
247
247
  ## Options
@@ -541,7 +541,7 @@ const pending = computed(() => status.value === 'pending')
541
541
  >
542
542
 
543
543
  <div v-if="status === 'idle'">
544
- Type an user ID
544
+ Type a user ID
545
545
  </div>
546
546
 
547
547
  <div v-else-if="pending">
@@ -80,6 +80,25 @@ There are two ways to deploy a Nuxt application to any static hosting services:
80
80
  - Static site generation (SSG) with `ssr: true` pre-renders routes of your application at build time. (This is the default behavior when running `nuxt generate`.) It will also generate `/200.html` and `/404.html` single-page app fallback pages, which can render dynamic routes or 404 errors on the client (though you may need to configure this on your static host).
81
81
  - Alternatively, you can prerender your site with `ssr: false` (static single-page app). This will produce HTML pages with an empty `<div id="__nuxt"></div>` where your Vue app would normally be rendered. You will lose many SEO benefits of prerendering your site, so it is suggested instead to use [`<ClientOnly>`](/docs/4.x/api/components/client-only) to wrap the portions of your site that cannot be server rendered (if any).
82
82
 
83
+ ### Static Fallback Pages
84
+
85
+ Nuxt can generate two fallback pages for static hosts:
86
+
87
+ - `200.html` is the single-page app fallback. Configure your host to serve it for unmatched routes when you want client-side routing to handle the URL.
88
+ - `404.html` is the not-found fallback. Configure your host to serve it for routes that should keep a 404 status.
89
+
90
+ `nuxt generate` and `nuxt build --prerender` generate these files automatically. If you use `nuxt build` with route rules to prerender selected routes, add the fallback page explicitly:
91
+
92
+ ```ts twoslash [nuxt.config.ts]
93
+ export default defineNuxtConfig({
94
+ routeRules: {
95
+ '/200.html': { prerender: true },
96
+ },
97
+ })
98
+ ```
99
+
100
+ Some providers use `200.html`, some use `404.html`, and some let you configure both. Check your hosting provider's static fallback or rewrite settings after deployment.
101
+
83
102
  :read-more{title="Nuxt prerendering" to="/docs/4.x/getting-started/prerendering"}
84
103
 
85
104
  ### Client-side Only Rendering
@@ -124,7 +124,7 @@ This will produce three files:
124
124
  - `200.html`
125
125
  - `404.html`
126
126
 
127
- The `200.html` and `404.html` might be useful for the hosting provider you are using.
127
+ The `200.html` file is intended for static hosts that need a success-status fallback for client-side routing. The `404.html` file is intended for static hosts that serve a not-found page while preserving a 404 status. Which file you should use depends on your hosting provider's fallback or rewrite settings.
128
128
 
129
129
  #### Skipping Client Fallback Generation
130
130
 
@@ -218,7 +218,7 @@ To improve performance, we need to first know how to measure it, starting with m
218
218
 
219
219
  ### Nuxi Analyze
220
220
 
221
- [This](/docs/4.x/api/commands/analyze) command of `nuxi` allows to analyze the production bundle or your Nuxt application. It leverages `vite-bundle-visualizer` (similar to `webpack-bundle-analyzer`) to generate a visual representation of your application's bundle, making it easier to identify which components take up the most space.
221
+ [This](/docs/4.x/api/commands/analyze) command of `nuxi` allows you to analyze the production bundle of your Nuxt application. It leverages `vite-bundle-visualizer` (similar to `webpack-bundle-analyzer`) to generate a visual representation of your application's bundle, making it easier to identify which components take up the most space.
222
222
 
223
223
  When you see a large block in the visualization, it often signals an opportunity for optimization—whether by splitting it into smaller parts, implementing lazy loading, or replacing it with a more efficient alternative, especially for third-party libraries.
224
224
 
@@ -239,5 +239,5 @@ Server routes are also type-checked using `tsconfig.app.json` in addition to `ts
239
239
  This is required because Nuxt infers the return types of your server endpoints to provide response types in [`$fetch`](/docs/4.x/api/utils/dollarfetch) and [`useFetch`](/docs/4.x/api/composables/use-fetch).
240
240
 
241
241
  ::warning
242
- This can cause issues when using **server-only types** in your route files. For example, if a module creates a server-only virtual file using [`addServerTemplate`](/docs/api/kit/templates#addservertemplate) and you declare types for it in `tsconfig.server.json`, those type declarations will only be available in the server context. When the app context type-checks your server routes, it won't recognize these server-only types and will report errors. To resolve this, you unfortunately need to declare such types in the app context as well.
242
+ This can cause issues when using **server-only types** in your route files. For example, if a module creates a server-only virtual file using [`addServerTemplate`](/docs/4.x/api/kit/templates#addservertemplate) and you declare types for it in `tsconfig.server.json`, those type declarations will only be available in the server context. When the app context type-checks your server routes, it won't recognize these server-only types and will report errors. To resolve this, you unfortunately need to declare such types in the app context as well.
243
243
  ::
@@ -14,7 +14,7 @@ This composable is available in Nuxt v4.4.2+.
14
14
 
15
15
  ## Description
16
16
 
17
- A composable for announcing dynamic content changes to screen readers. Unlike [`useRouteAnnouncer`](/docs/api/composables/use-route-announcer) which automatically announces route changes, `useAnnouncer` gives you manual control over what and when to announce.
17
+ A composable for announcing dynamic content changes to screen readers. Unlike [`useRouteAnnouncer`](/docs/4.x/api/composables/use-route-announcer) which automatically announces route changes, `useAnnouncer` gives you manual control over what and when to announce.
18
18
 
19
19
  Use this for in-page updates like form validation, async operations, toast notifications, and live content changes.
20
20
 
@@ -251,7 +251,7 @@ type AsyncDataOptions<DataT> = {
251
251
  default?: () => DataT | Ref<DataT> | null
252
252
  transform?: (input: DataT) => DataT | Promise<DataT>
253
253
  pick?: string[]
254
- watch?: MultiWatchSources | false
254
+ watch?: MultiWatchSources
255
255
  getCachedData?: (key: string, nuxtApp: NuxtApp, ctx: AsyncDataRequestContext) => DataT | undefined
256
256
  timeout?: number
257
257
  }
@@ -23,10 +23,11 @@ You can use this composable in your components, pages, or plugins to access or r
23
23
  ```ts
24
24
  interface NuxtError<DataT = unknown> {
25
25
  status: number
26
- statusText: string
26
+ statusText?: string
27
27
  message: string
28
28
  data?: DataT
29
- error?: true
29
+ cause?: unknown
30
+ fatal: boolean
30
31
  }
31
32
 
32
33
  export const useError: () => Ref<NuxtError | undefined>
@@ -240,7 +240,7 @@ This only caches data when `experimental.payloadExtraction` in `nuxt.config` is
240
240
  - `error`: Request failed
241
241
 
242
242
  ::note
243
- If you have not fetched data on the server (for example, with `server: false`), then the data _will not_ be fetched until hydration completes. This means even if you await `useFetch` on client-side, `data` will remain null within `<script setup>`.
243
+ If you have not fetched data on the server (for example, with `server: false`), then the data _will not_ be fetched until hydration completes. This means even if you await `useFetch` on client-side, `data` will remain undefined within `<script setup>`.
244
244
  ::
245
245
 
246
246
  ### Examples
@@ -28,7 +28,7 @@ To use `useNuxtData`, ensure that the data-fetching composable (`useFetch`, `use
28
28
 
29
29
  ## Return Values
30
30
 
31
- - `data`: A reactive reference to the cached data associated with the provided key. If no cached data exists, the value will be `null`. This `Ref` automatically updates if the cached data changes, allowing seamless reactivity in your components.
31
+ - `data`: A reactive reference to the cached data associated with the provided key. If no cached data exists, the value will be `undefined`. This `Ref` automatically updates if the cached data changes, allowing seamless reactivity in your components.
32
32
 
33
33
  ## Example
34
34
 
@@ -14,7 +14,7 @@ npx nuxt test [ROOTDIR] [--cwd=<directory>] [--logLevel=<silent|info|verbose>] [
14
14
  ```
15
15
  <!--/test-cmd-->
16
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.
17
+ The `test` command runs tests using [`@nuxt/test-utils`](/docs/4.x/getting-started/testing). This command sets `process.env.NODE_ENV` to `test` if not already set.
18
18
 
19
19
  ## Arguments
20
20
 
@@ -65,7 +65,7 @@ You can read more about Nitro route rules in the [Nitro documentation](https://n
65
65
  ::
66
66
 
67
67
  ::tip{icon="i-lucide-video" to="https://vueschool.io/lessons/adding-route-rules-and-route-middlewares?friend=nuxt" target="_blank"}
68
- Watch Vue School video about adding route rules and route middelwares.
68
+ Watch Vue School video about adding route rules and route middlewares.
69
69
  ::
70
70
 
71
71
  ### Usage
@@ -116,7 +116,7 @@ function extendRouteRules (route: string, rule: NitroRouteConfig, options?: Exte
116
116
  About route rules configurations, you can get more detail in [Hybrid Rendering > Route Rules](/docs/4.x/guide/concepts/rendering#route-rules).
117
117
  ::
118
118
 
119
- **options**: A object to pass to the route configuration. If `override` is set to `true`, it will override the existing route configuration.
119
+ **options**: An object to pass to the route configuration. If `override` is set to `true`, it will override the existing route configuration.
120
120
 
121
121
  | Name | Type | Default | Description |
122
122
  | ---------- | --------- | ------- | -------------------------------------------- |
@@ -133,7 +133,7 @@ Read more about route middlewares in the [Route middleware documentation](/docs/
133
133
  ::
134
134
 
135
135
  ::tip{icon="i-lucide-video" to="https://vueschool.io/lessons/adding-route-rules-and-route-middlewares?friend=nuxt" target="_blank"}
136
- Watch Vue School video about adding route rules and route middelwares.
136
+ Watch Vue School video about adding route rules and route middlewares.
137
137
  ::
138
138
 
139
139
  ### Usage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/docs-nightly",
3
- "version": "4.4.7-29673476.91186dc5",
3
+ "version": "4.4.8-29682245.e6d578fe",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",