You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -11,6 +11,36 @@ Internally, Nuxt uses `@nuxt/schema` to define these experimental features. You
11
11
Note that these features are experimental and could be removed or modified in the future.
12
12
::
13
13
14
+
## alwaysRunFetchOnKeyChange
15
+
16
+
Whether to run `useFetch` when the key changes, even if it is set to `immediate: false` and it has not been triggered yet.
17
+
18
+
`useFetch` and `useAsyncData` will always run when the key changes if `immediate: true` or if it has been already triggered.
19
+
20
+
This flag is disabled by default, but you can enable this feature:
21
+
22
+
```ts twoslash [nuxt.config.ts]
23
+
exportdefaultdefineNuxtConfig({
24
+
experimental: {
25
+
alwaysRunFetchOnKeyChange: true,
26
+
},
27
+
})
28
+
```
29
+
30
+
## appManifest
31
+
32
+
Use app manifests to respect route rules on client-side.
33
+
34
+
This flag is enabled by default, but you can disable this feature:
35
+
36
+
```ts twoslash [nuxt.config.ts]
37
+
exportdefaultdefineNuxtConfig({
38
+
experimental: {
39
+
appManifest: false,
40
+
},
41
+
})
42
+
```
43
+
14
44
## asyncContext
15
45
16
46
Enable native async context to be accessible for nested composables in Nuxt and in Nitro. This opens the possibility to use composables inside async composables and reduce the chance to get the `Nuxt instance is unavailable` error.
Externalizes `vue`, `@vue/*` and `vue-router` when building.
45
75
46
-
*Enabled by default.*
76
+
This flag is enabled by default, but you can disable this feature:
47
77
48
78
```ts twoslash [nuxt.config.ts]
49
79
exportdefaultdefineNuxtConfig({
50
80
experimental: {
51
-
externalVue: true,
81
+
externalVue: false,
52
82
},
53
83
})
54
84
```
@@ -61,7 +91,9 @@ This feature will likely be removed in a near future.
61
91
62
92
Emits `app:chunkError` hook when there is an error loading vite/webpack chunks. Default behavior is to perform a reload of the new route on navigation to a new route when a chunk fails to load.
63
93
64
-
If you set this to `'automatic-immediate'` Nuxt will reload the current route immediately, instead of waiting for a navigation. This is useful for chunk errors that are not triggered by navigation, e.g., when your Nuxt app fails to load a [lazy component](/docs/4.x/guide/directory-structure/app/components#dynamic-imports). A potential downside of this behavior is undesired reloads, e.g., when your app does not need the chunk that caused the error.
94
+
By default, Nuxt will also perform a reload of the new route when a chunk fails to load when navigating to a new route (`automatic`).
95
+
96
+
Setting `automatic-immediate` will lead Nuxt to perform a reload of the current route right when a chunk fails to load (instead of waiting for navigation). This is useful for chunk errors that are not triggered by navigation, e.g., when your Nuxt app fails to load a [lazy component](/docs/4.x/guide/directory-structure/app/components#dynamic-imports). A potential downside of this behavior is undesired reloads, e.g., when your app does not need the chunk that caused the error.
65
97
66
98
You can disable automatic handling by setting this to `false`, or handle chunk errors manually by setting it to `manual`.
Whether Nuxt should throw an error (and fail to load) if a Nuxt module is incompatible.
111
+
112
+
This feature is disabled by default.
113
+
114
+
```ts twoslash [nuxt.config.ts]
115
+
exportdefaultdefineNuxtConfig({
116
+
experimental: {
117
+
enforceModuleCompatibility: true,
118
+
},
119
+
})
120
+
```
121
+
76
122
## restoreState
77
123
78
124
Allows Nuxt app state to be restored from `sessionStorage` when reloading the page after a chunk error or manual [`reloadNuxtApp()`](/docs/4.x/api/utils/reload-nuxt-app) call.
@@ -116,12 +162,12 @@ Read more in `defineRouteRules` utility.
116
162
117
163
Allows rendering of JSON payloads with support for revivifying complex types.
118
164
119
-
*Enabled by default.*
165
+
This flag is enabled by default, but you can disable this feature:
Enables CookieStore support to listen for cookie updates (if supported by the browser) and refresh `useCookie` ref values.
354
414
415
+
This flag is enabled by default, but you can disable this feature:
416
+
355
417
```ts twoslash [nuxt.config.ts]
356
418
exportdefaultdefineNuxtConfig({
357
419
experimental: {
358
-
cookieStore: true,
420
+
cookieStore: false,
359
421
},
360
422
})
361
423
```
@@ -368,6 +430,10 @@ Read more about the **CookieStore**.
368
430
369
431
Caches Nuxt build artifacts based on a hash of the configuration and source files.
370
432
433
+
This only works for source files within `srcDir` and `serverDir` for the Vue/Nitro parts of your app.
434
+
435
+
This flag is disabled by default, but you can enable it:
436
+
371
437
```ts twoslash [nuxt.config.ts]
372
438
exportdefaultdefineNuxtConfig({
373
439
experimental: {
@@ -396,6 +462,20 @@ In addition, any changes to files within `srcDir` will trigger a rebuild of the
396
462
A maximum of 10 cache tarballs are kept.
397
463
::
398
464
465
+
## checkOutdatedBuildInterval
466
+
467
+
Set the time interval (in ms) to check for new builds. Disabled when `experimental.appManifest` is `false`.
468
+
469
+
Set to `false` to disable.
470
+
471
+
```ts twoslash [nuxt.config.ts]
472
+
exportdefaultdefineNuxtConfig({
473
+
experimental: {
474
+
checkOutdatedBuildInterval: 3600000, // 1 hour, or false to disable
475
+
},
476
+
})
477
+
```
478
+
399
479
## extraPageMetaExtractionKeys
400
480
401
481
The `definePageMeta()` macro is a useful way to collect build-time meta about pages. Nuxt itself provides a set list of supported keys which is used to power some of the internal features such as redirects, page aliases and custom paths.
This allows modules to access additional metadata from the page metadata in the build context. If you are using this within a module, it's recommended also to [augment the `NuxtPage` types with your keys](/docs/4.x/guide/directory-structure/app/pages#typing-custom-metadata).
427
507
508
+
## navigationRepaint
509
+
510
+
Wait for a single animation frame before navigation, which gives an opportunity for the browser to repaint, acknowledging user interaction.
511
+
512
+
It can reduce INP when navigating on prerendered routes.
513
+
514
+
This flag is enabled by default, but you can disable this feature:
515
+
516
+
```ts twoslash [nuxt.config.ts]
517
+
exportdefaultdefineNuxtConfig({
518
+
experimental: {
519
+
navigationRepaint: false,
520
+
},
521
+
})
522
+
```
523
+
428
524
## normalizeComponentNames
429
525
430
526
Nuxt updates auto-generated Vue component names to match the full component name you would use to auto-import the component.
@@ -537,9 +633,11 @@ Read more about lazy hydration.
537
633
538
634
## templateImportResolution
539
635
540
-
Controls how imports in Nuxt templates are resolved. By default, Nuxt attempts to resolve imports in templates relative to the module that added them.
636
+
Disable resolving imports into Nuxt templates from the path of the module that added the template.
637
+
638
+
By default, Nuxt attempts to resolve imports in templates relative to the module that added them. Setting this to `false` disables this behavior, which may be useful if you're experiencing resolution conflicts in certain environments.
541
639
542
-
This is enabled by default, so if you're experiencing resolution conflicts in certain environments, you can disable this behavior:
640
+
This flag is enabled by default, but youcan disable this feature:
By default the route object returned by the auto-imported `useRoute()` composable is kept in sync with the current page in view in `<NuxtPage>`. This is not true for `vue-router`'s exported `useRoute` or for the default `$route` object available in your Vue templates.
657
+
658
+
By enabling this option a mixin will be injected to keep the `$route` template object in sync with Nuxt's managed `useRoute()`.
659
+
660
+
This flag is enabled by default, but you can disable this feature:
661
+
662
+
```ts twoslash [nuxt.config.ts]
663
+
exportdefaultdefineNuxtConfig({
664
+
experimental: {
665
+
templateRouteInjection: false,
666
+
},
667
+
})
668
+
```
669
+
556
670
## decorators
557
671
558
672
This option enables enabling decorator syntax across your entire Nuxt/Nitro app, powered by [esbuild](https://github.com/evanw/esbuild/releases/tag/v0.21.3).
@@ -591,10 +705,40 @@ const value = new SomeClass().someMethod()
591
705
// this will return 'decorated'
592
706
```
593
707
708
+
## defaults
709
+
710
+
This allows specifying the default options for core Nuxt components and composables.
711
+
712
+
These options will likely be moved elsewhere in the future, such as into `app.config` or into the `app/` directory.
713
+
714
+
```ts twoslash [nuxt.config.ts]
715
+
exportdefaultdefineNuxtConfig({
716
+
experimental: {
717
+
defaults: {
718
+
nuxtLink: {
719
+
componentName: 'NuxtLink',
720
+
prefetch: true,
721
+
prefetchOn: {
722
+
visibility: true,
723
+
},
724
+
},
725
+
useAsyncData: {
726
+
deep: true,
727
+
errorValue: 'null',
728
+
value: 'null',
729
+
},
730
+
},
731
+
},
732
+
})
733
+
```
734
+
594
735
## purgeCachedData
595
736
596
-
Nuxt will automatically purge cached data from `useAsyncData` and `nuxtApp.static.data`. This helps prevent memory leaks
597
-
and ensures fresh data is loaded when needed, but it is possible to disable it:
737
+
Whether to clean up Nuxt static and asyncData caches on route navigation.
738
+
739
+
Nuxt will automatically purge cached data from `useAsyncData` and `nuxtApp.static.data`. This helps prevent memory leaks and ensures fresh data is loaded when needed, but it is possible to disable it.
740
+
741
+
This flag is enabled by default, but you can disable this feature:
598
742
599
743
```ts twoslash [nuxt.config.ts]
600
744
exportdefaultdefineNuxtConfig({
@@ -612,10 +756,12 @@ See PR #31379 for implementation details.
612
756
613
757
Whether to call and use the result from `getCachedData` when refreshing data for `useAsyncData` and `useFetch` (whether by `watch`, `refreshNuxtData()`, or a manual `refresh()` call.
614
758
759
+
This flag is enabled by default, but you can disable this feature:
- Add the capo.js head plugin in order to render tags in of the head in a more performant way.
778
+
- Uses the hash hydration plugin to reduce initial hydration
779
+
780
+
This flag is enabled by default, but you can disable this feature:
781
+
782
+
```ts twoslash [nuxt.config.ts]
783
+
exportdefaultdefineNuxtConfig({
784
+
experimental: {
785
+
headNext: false,
786
+
},
787
+
})
788
+
```
789
+
627
790
## pendingWhenIdle
628
791
629
-
If set to `false`, the `pending` object returned from `useAsyncData`, `useFetch`, `useLazyAsyncData` and `useLazyFetch` will be a computed property that is `true`only when `status` is also pending.
792
+
For `useAsyncData` and `useFetch`, whether `pending` should be `true` when data has not yet started to be fetched.
630
793
631
-
That means that when `immediate: false` is passed, `pending` will be `false` until the first request is made.
794
+
This flag is disabled by default, but you can enable this feature:
0 commit comments