@nuxt/docs-nightly 4.2.0-29333825.6cbfa2c8 → 4.2.0-29334440.d083e066

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.
@@ -87,6 +87,44 @@ export default defineNuxtConfig({
87
87
  This feature will likely be removed in a near future.
88
88
  ::
89
89
 
90
+ ## extractAsyncDataHandlers
91
+
92
+ Extracts handler functions from `useAsyncData` and `useLazyAsyncData` calls into separate chunks for improved code splitting and caching efficiency.
93
+
94
+ ```ts twoslash [nuxt.config.ts]
95
+ export default defineNuxtConfig({
96
+ experimental: {
97
+ extractAsyncDataHandlers: true,
98
+ },
99
+ })
100
+ ```
101
+
102
+ This feature transforms inline handler functions into dynamically imported chunks:
103
+
104
+ ```vue
105
+ <!-- Before -->
106
+ <script setup>
107
+ const { data } = await useAsyncData('user', async () => {
108
+ return await $fetch('/api/user')
109
+ })
110
+ </script>
111
+ ```
112
+
113
+ ```vue
114
+ <!-- After transformation -->
115
+ <script setup>
116
+ const { data } = await useAsyncData('user', () =>
117
+ import('/generated-chunk.js').then(r => r.default()),
118
+ )
119
+ </script>
120
+ ```
121
+
122
+ The benefit of this transformation is that we can split out data fetching logic &mdash; while still allowing the code to be loaded if required.
123
+
124
+ ::important
125
+ This feature is only recommended for **static builds** with payload extraction, and where data does not need to be re-fetched at runtime.
126
+ ::
127
+
90
128
  ## emitRouteChunkError
91
129
 
92
130
  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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/docs-nightly",
3
- "version": "4.2.0-29333825.6cbfa2c8",
3
+ "version": "4.2.0-29334440.d083e066",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",