@nuxt/docs-nightly 5.0.0-29788347.3c4e1708 → 5.0.0-29788537.bc41aa9c

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.
@@ -253,6 +253,31 @@ export default defineNuxtConfig({
253
253
  })
254
254
  ```
255
255
 
256
+ ## early404
257
+
258
+ Responds with an early 404 error for requests whose path cannot match any page route, without loading the Vue app, its plugins or middleware on the server.
259
+
260
+ Page routes (including aliases) are compiled into a static route matcher at build time, and incoming requests are checked against it before server-side rendering begins. Requests that cannot match any page skip loading the app entirely and go straight to the error page.
261
+
262
+ Requests without an `Accept: text/html` header (API clients, most scanners) receive a JSON error without loading the app at all. HTML requests still server-render the error page. A [`cache` route rule](/docs/4.x/guide/concepts/rendering#hybrid-rendering) covering the path advertises its `maxAge` as `Cache-Control` on GET/HEAD misses too, letting a CDN absorb repeat requests for unknown paths.
263
+
264
+ ```ts twoslash [nuxt.config.ts]
265
+ export default defineNuxtConfig({
266
+ experimental: {
267
+ early404: true,
268
+ },
269
+ })
270
+ ```
271
+
272
+ ::warning
273
+ This is opt-in because it can break apps that rely on runtime routing:
274
+
275
+ - pages added dynamically with `router.addRoute()` in a plugin. To surface this early, `addRoute` is removed from the type of the router returned by [`useRouter`](/docs/4.x/api/composables/use-router) when the option is enabled.
276
+ - route middleware that redirects unknown paths to existing pages
277
+
278
+ The option is disabled automatically in development, when `hashMode` is enabled, when a root-level catch-all page (such as `pages/[...slug].vue`) matches every path, and when a custom `app/router.options` file may modify `routes` (a file whose default export is a plain object without a `routes` key remains compatible).
279
+ ::
280
+
256
281
  ## clientFallback
257
282
 
258
283
  Enables the experimental [`<NuxtClientFallback>`](/docs/4.x/api/components/nuxt-client-fallback) component for rendering content on the client if there's an error in SSR.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/docs-nightly",
3
- "version": "5.0.0-29788347.3c4e1708",
3
+ "version": "5.0.0-29788537.bc41aa9c",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",