@nuxt/docs-nightly 4.2.2-29404491.1c73525a → 4.2.2-29413365.2a912219
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/03.configuration.md +23 -23
- package/1.getting-started/18.upgrade.md +17 -17
- package/4.api/2.composables/use-cookie.md +15 -15
- package/4.api/2.composables/use-fetch.md +31 -31
- package/4.api/2.composables/use-lazy-fetch.md +8 -8
- package/4.api/3.utils/define-nuxt-plugin.md +10 -10
- package/4.api/3.utils/navigate-to.md +9 -9
- package/4.api/4.commands/add.md +10 -10
- package/4.api/4.commands/analyze.md +11 -11
- package/4.api/4.commands/build-module.md +11 -11
- package/4.api/4.commands/build.md +12 -12
- package/4.api/4.commands/cleanup.md +6 -6
- package/4.api/4.commands/dev.md +23 -23
- package/4.api/4.commands/devtools.md +7 -7
- package/4.api/4.commands/generate.md +11 -11
- package/4.api/4.commands/info.md +6 -6
- package/4.api/4.commands/init.md +18 -18
- package/4.api/4.commands/module.md +17 -17
- package/4.api/4.commands/prepare.md +10 -10
- package/4.api/4.commands/preview.md +11 -11
- package/4.api/4.commands/test.md +9 -9
- package/4.api/4.commands/typecheck.md +9 -9
- package/4.api/4.commands/upgrade.md +10 -10
- package/4.api/5.kit/1.modules.md +15 -15
- package/4.api/5.kit/10.templates.md +23 -23
- package/4.api/5.kit/11.nitro.md +35 -35
- package/4.api/5.kit/14.builder.md +15 -15
- package/4.api/5.kit/16.layers.md +12 -12
- package/4.api/5.kit/4.autoimports.md +18 -18
- package/4.api/5.kit/5.components.md +35 -35
- package/4.api/6.advanced/1.hooks.md +84 -84
- package/5.community/6.roadmap.md +25 -25
- package/package.json +1 -1
package/4.api/5.kit/11.nitro.md
CHANGED
|
@@ -41,13 +41,13 @@ function addServerHandler (handler: NitroEventHandler): void
|
|
|
41
41
|
|
|
42
42
|
**handler**: A handler object with the following properties:
|
|
43
43
|
|
|
44
|
-
| Property
|
|
45
|
-
|
|
46
|
-
| `handler`
|
|
47
|
-
| `route`
|
|
48
|
-
| `middleware
|
|
49
|
-
| `lazy`
|
|
50
|
-
| `method`
|
|
44
|
+
| Property | Type | Required | Description |
|
|
45
|
+
|--------------|-----------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------|
|
|
46
|
+
| `handler` | `string` | `true` | Path to event handler. |
|
|
47
|
+
| `route` | `string` | `false` | Path prefix or route. If an empty string used, will be used as a middleware. |
|
|
48
|
+
| `middleware` | `boolean` | `false` | Specifies this is a middleware handler. Middleware are called on every route and should normally return nothing to pass to the next handlers. |
|
|
49
|
+
| `lazy` | `boolean` | `false` | Use lazy loading to import the handler. This is useful when you only want to load the handler on demand. |
|
|
50
|
+
| `method` | `string` | `false` | Router method matcher. If handler name contains method name, it will be used as a default value. |
|
|
51
51
|
|
|
52
52
|
### Examples
|
|
53
53
|
|
|
@@ -126,10 +126,10 @@ function addDevServerHandler (handler: NitroDevEventHandler): void
|
|
|
126
126
|
|
|
127
127
|
**handler**: A handler object with the following properties:
|
|
128
128
|
|
|
129
|
-
| Property
|
|
130
|
-
|
|
131
|
-
| `handler`
|
|
132
|
-
| `route`
|
|
129
|
+
| Property | Type | Required | Description |
|
|
130
|
+
|-----------|----------------|----------|------------------------------------------------------------------------------|
|
|
131
|
+
| `handler` | `EventHandler` | `true` | Event handler. |
|
|
132
|
+
| `route` | `string` | `false` | Path prefix or route. If an empty string used, will be used as a middleware. |
|
|
133
133
|
|
|
134
134
|
### Examples
|
|
135
135
|
|
|
@@ -222,9 +222,9 @@ function addServerPlugin (plugin: string): void
|
|
|
222
222
|
|
|
223
223
|
### Parameters
|
|
224
224
|
|
|
225
|
-
| Property
|
|
226
|
-
|
|
227
|
-
| `plugin`
|
|
225
|
+
| Property | Type | Required | Description |
|
|
226
|
+
|----------|----------|----------|---------------------------------------------------------------------------------------------------------------|
|
|
227
|
+
| `plugin` | `string` | `true` | Path to the plugin. The plugin must export a default function that accepts the Nitro instance as an argument. |
|
|
228
228
|
|
|
229
229
|
### Examples
|
|
230
230
|
|
|
@@ -293,9 +293,9 @@ function addPrerenderRoutes (routes: string | string[]): void
|
|
|
293
293
|
|
|
294
294
|
### Parameters
|
|
295
295
|
|
|
296
|
-
| Property
|
|
297
|
-
|
|
298
|
-
| `routes`
|
|
296
|
+
| Property | Type | Required | Description |
|
|
297
|
+
|----------|---------------------------------|----------|---------------------------------------------|
|
|
298
|
+
| `routes` | `string \| string[]`{lang="ts"} | `true` | A route or an array of routes to prerender. |
|
|
299
299
|
|
|
300
300
|
## `addServerImports`
|
|
301
301
|
|
|
@@ -333,16 +333,16 @@ function addServerImports (dirs: Import | Import[]): void
|
|
|
333
333
|
|
|
334
334
|
`imports`: An object or an array of objects with the following properties:
|
|
335
335
|
|
|
336
|
-
| Property
|
|
337
|
-
|
|
338
|
-
| `name`
|
|
339
|
-
| `from`
|
|
340
|
-
| `priority`
|
|
341
|
-
| `disabled`
|
|
342
|
-
| `meta`
|
|
343
|
-
| `type`
|
|
344
|
-
| `typeFrom`
|
|
345
|
-
| `as`
|
|
336
|
+
| Property | Type | Required | Description |
|
|
337
|
+
|------------|-----------------------|----------|-----------------------------------------------------------------------------------------------------------------|
|
|
338
|
+
| `name` | `string` | `true` | Import name to be detected. |
|
|
339
|
+
| `from` | `string` | `true` | Module specifier to import from. |
|
|
340
|
+
| `priority` | `number` | `false` | Priority of the import; if multiple imports have the same name, the one with the highest priority will be used. |
|
|
341
|
+
| `disabled` | `boolean` | `false` | If this import is disabled. |
|
|
342
|
+
| `meta` | `Record<string, any>` | `false` | Metadata of the import. |
|
|
343
|
+
| `type` | `boolean` | `false` | If this import is a pure type import. |
|
|
344
|
+
| `typeFrom` | `string` | `false` | Use this as the `from` value when generating type declarations. |
|
|
345
|
+
| `as` | `string` | `false` | Import as this name. |
|
|
346
346
|
|
|
347
347
|
## `addServerImportsDir`
|
|
348
348
|
|
|
@@ -373,10 +373,10 @@ function addServerImportsDir (dirs: string | string[], opts: { prepend?: boolean
|
|
|
373
373
|
|
|
374
374
|
### Parameters
|
|
375
375
|
|
|
376
|
-
| Property
|
|
377
|
-
|
|
378
|
-
| `dirs`
|
|
379
|
-
| `opts`
|
|
376
|
+
| Property | Type | Required | Description |
|
|
377
|
+
|----------|---------------------------------|----------|---------------------------------------------------------------------------------------------------------------------|
|
|
378
|
+
| `dirs` | `string \| string[]`{lang="ts"} | `true` | A directory or an array of directories to register to be scanned by Nitro. |
|
|
379
|
+
| `opts` | `{ prepend?: boolean }` | `false` | Options for the import directory. If `prepend` is `true`, the directory is added to the beginning of the scan list. |
|
|
380
380
|
|
|
381
381
|
### Examples
|
|
382
382
|
|
|
@@ -453,10 +453,10 @@ function addServerScanDir (dirs: string | string[], opts: { prepend?: boolean })
|
|
|
453
453
|
|
|
454
454
|
### Parameters
|
|
455
455
|
|
|
456
|
-
| Property
|
|
457
|
-
|
|
458
|
-
| `dirs`
|
|
459
|
-
| `opts`
|
|
456
|
+
| Property | Type | Required | Description |
|
|
457
|
+
|----------|---------------------------------|----------|---------------------------------------------------------------------------------------------------------------------|
|
|
458
|
+
| `dirs` | `string \| string[]`{lang="ts"} | `true` | A directory or an array of directories to register to be scanned for by Nitro as server dirs. |
|
|
459
|
+
| `opts` | `{ prepend?: boolean }` | `false` | Options for the import directory. If `prepend` is `true`, the directory is added to the beginning of the scan list. |
|
|
460
460
|
|
|
461
461
|
### Examples
|
|
462
462
|
|
|
@@ -93,13 +93,13 @@ Check out the Vite website for more information about its configuration.
|
|
|
93
93
|
|
|
94
94
|
**`options`**: Options to pass to the callback function. This object can have the following properties:
|
|
95
95
|
|
|
96
|
-
| Property | Type | Required | Description
|
|
97
|
-
|
|
98
|
-
| `dev` | `boolean` | `false` | If set to `true`, the callback function will be called when building in development mode.
|
|
99
|
-
| `build` | `boolean` | `false` | If set to `true`, the callback function will be called when building in production mode.
|
|
96
|
+
| Property | Type | Required | Description |
|
|
97
|
+
|-----------|-----------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
98
|
+
| `dev` | `boolean` | `false` | If set to `true`, the callback function will be called when building in development mode. |
|
|
99
|
+
| `build` | `boolean` | `false` | If set to `true`, the callback function will be called when building in production mode. |
|
|
100
100
|
| `server` | `boolean` | `false` | If set to `true`, the callback function will be called when building the server bundle. **Deprecated in Nuxt 5+.** Use `addVitePlugin()` with `applyToEnvironment()` instead. |
|
|
101
101
|
| `client` | `boolean` | `false` | If set to `true`, the callback function will be called when building the client bundle. **Deprecated in Nuxt 5+.** Use `addVitePlugin()` with `applyToEnvironment()` instead. |
|
|
102
|
-
| `prepend` | `boolean` | `false` | If set to `true`, the callback function will be prepended to the array with `unshift()` instead of `push()`.
|
|
102
|
+
| `prepend` | `boolean` | `false` | If set to `true`, the callback function will be prepended to the array with `unshift()` instead of `push()`. |
|
|
103
103
|
|
|
104
104
|
## `extendWebpackConfig`
|
|
105
105
|
|
|
@@ -143,7 +143,7 @@ Check out webpack website for more information about its configuration.
|
|
|
143
143
|
**`options`**: Options to pass to the callback function. This object can have the following properties:
|
|
144
144
|
|
|
145
145
|
| Property | Type | Required | Description |
|
|
146
|
-
|
|
146
|
+
|-----------|-----------|----------|--------------------------------------------------------------------------------------------------------------|
|
|
147
147
|
| `dev` | `boolean` | `false` | If set to `true`, the callback function will be called when building in development mode. |
|
|
148
148
|
| `build` | `boolean` | `false` | If set to `true`, the callback function will be called when building in production mode. |
|
|
149
149
|
| `server` | `boolean` | `false` | If set to `true`, the callback function will be called when building the server bundle. |
|
|
@@ -211,13 +211,13 @@ See [Vite website](https://vite.dev/guide/api-plugin) for more information about
|
|
|
211
211
|
|
|
212
212
|
**`options`**: Options to pass to the callback function. This object can have the following properties:
|
|
213
213
|
|
|
214
|
-
| Property | Type | Required | Description
|
|
215
|
-
|
|
216
|
-
| `dev` | `boolean` | `false` | If set to `true`, the callback function will be called when building in development mode.
|
|
217
|
-
| `build` | `boolean` | `false` | If set to `true`, the callback function will be called when building in production mode.
|
|
214
|
+
| Property | Type | Required | Description |
|
|
215
|
+
|-----------|-----------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
216
|
+
| `dev` | `boolean` | `false` | If set to `true`, the callback function will be called when building in development mode. |
|
|
217
|
+
| `build` | `boolean` | `false` | If set to `true`, the callback function will be called when building in production mode. |
|
|
218
218
|
| `server` | `boolean` | `false` | If set to `true`, the callback function will be called when building the server bundle. **Deprecated in Nuxt 5+.** Use `applyToEnvironment()` instead. |
|
|
219
219
|
| `client` | `boolean` | `false` | If set to `true`, the callback function will be called when building the client bundle. **Deprecated in Nuxt 5+.** Use `applyToEnvironment()` instead. |
|
|
220
|
-
| `prepend` | `boolean` | `false` | If set to `true`, the callback function will be prepended to the array with `unshift()` instead of `push()`.
|
|
220
|
+
| `prepend` | `boolean` | `false` | If set to `true`, the callback function will be prepended to the array with `unshift()` instead of `push()`. |
|
|
221
221
|
|
|
222
222
|
## `addWebpackPlugin`
|
|
223
223
|
|
|
@@ -270,8 +270,8 @@ See [webpack website](https://webpack.js.org/concepts/plugins/) for more informa
|
|
|
270
270
|
|
|
271
271
|
**`options`**: Options to pass to the callback function. This object can have the following properties:
|
|
272
272
|
|
|
273
|
-
| Property | Type | Required | Description
|
|
274
|
-
|
|
273
|
+
| Property | Type | Required | Description |
|
|
274
|
+
|-----------|-----------|----------|--------------------------------------------------------------------------------------------------------------|
|
|
275
275
|
| `dev` | `boolean` | `false` | If set to `true`, the callback function will be called when building in development mode. |
|
|
276
276
|
| `build` | `boolean` | `false` | If set to `true`, the callback function will be called when building in production mode. |
|
|
277
277
|
| `server` | `boolean` | `false` | If set to `true`, the callback function will be called when building the server bundle. |
|
|
@@ -306,8 +306,8 @@ function addBuildPlugin (pluginFactory: AddBuildPluginFactory, options?: ExtendC
|
|
|
306
306
|
|
|
307
307
|
**`options`**: Options to pass to the callback function. This object can have the following properties:
|
|
308
308
|
|
|
309
|
-
| Property | Type | Required | Description
|
|
310
|
-
|
|
309
|
+
| Property | Type | Required | Description |
|
|
310
|
+
|-----------|-----------|----------|--------------------------------------------------------------------------------------------------------------|
|
|
311
311
|
| `dev` | `boolean` | `false` | If set to `true`, the callback function will be called when building in development mode. |
|
|
312
312
|
| `build` | `boolean` | `false` | If set to `true`, the callback function will be called when building in production mode. |
|
|
313
313
|
| `server` | `boolean` | `false` | If set to `true`, the callback function will be called when building the server bundle. |
|
package/4.api/5.kit/16.layers.md
CHANGED
|
@@ -85,18 +85,18 @@ This ordering matches Nuxt's layer resolution system, where user-defined configu
|
|
|
85
85
|
|
|
86
86
|
**`LayerDirectories`**: An object containing the resolved directory paths for a layer.
|
|
87
87
|
|
|
88
|
-
| Property | Type | Description
|
|
89
|
-
|
|
90
|
-
| `root` | `string` | The root directory of the layer (equivalent to `rootDir`)
|
|
91
|
-
| `server` | `string` | The server directory for Nitro server-side code
|
|
92
|
-
| `modules` | `string` | The local modules directory
|
|
93
|
-
| `shared` | `string` | The shared directory for code used by both client and server
|
|
94
|
-
| `app` | `string` | The source directory of the layer (equivalent to `srcDir`)
|
|
95
|
-
| `public` | `string` | The public directory for static assets
|
|
96
|
-
| `appLayouts` | `string` | The layouts directory for Vue layout components
|
|
97
|
-
| `appMiddleware` | `string` | The middleware directory for route middleware
|
|
98
|
-
| `appPages` | `string` | The pages directory for file-based routing
|
|
99
|
-
| `appPlugins` | `string` | The plugins directory for Nuxt plugins
|
|
88
|
+
| Property | Type | Description |
|
|
89
|
+
|-----------------|----------|--------------------------------------------------------------|
|
|
90
|
+
| `root` | `string` | The root directory of the layer (equivalent to `rootDir`) |
|
|
91
|
+
| `server` | `string` | The server directory for Nitro server-side code |
|
|
92
|
+
| `modules` | `string` | The local modules directory |
|
|
93
|
+
| `shared` | `string` | The shared directory for code used by both client and server |
|
|
94
|
+
| `app` | `string` | The source directory of the layer (equivalent to `srcDir`) |
|
|
95
|
+
| `public` | `string` | The public directory for static assets |
|
|
96
|
+
| `appLayouts` | `string` | The layouts directory for Vue layout components |
|
|
97
|
+
| `appMiddleware` | `string` | The middleware directory for route middleware |
|
|
98
|
+
| `appPages` | `string` | The pages directory for file-based routing |
|
|
99
|
+
| `appPlugins` | `string` | The plugins directory for Nuxt plugins |
|
|
100
100
|
|
|
101
101
|
### Examples
|
|
102
102
|
|
|
@@ -58,16 +58,16 @@ function addImports (imports: Import | Import[]): void
|
|
|
58
58
|
|
|
59
59
|
`imports`: An object or an array of objects with the following properties:
|
|
60
60
|
|
|
61
|
-
| Property
|
|
62
|
-
|
|
63
|
-
| `name`
|
|
64
|
-
| `from`
|
|
65
|
-
| `priority`
|
|
66
|
-
| `disabled`
|
|
67
|
-
| `meta`
|
|
68
|
-
| `type`
|
|
69
|
-
| `typeFrom`
|
|
70
|
-
| `as`
|
|
61
|
+
| Property | Type | Required | Description |
|
|
62
|
+
|------------|-----------------------|----------|-----------------------------------------------------------------------------------------------------------------|
|
|
63
|
+
| `name` | `string` | `true` | Import name to be detected. |
|
|
64
|
+
| `from` | `string` | `true` | Module specifier to import from. |
|
|
65
|
+
| `priority` | `number` | `false` | Priority of the import; if multiple imports have the same name, the one with the highest priority will be used. |
|
|
66
|
+
| `disabled` | `boolean` | `false` | If this import is disabled. |
|
|
67
|
+
| `meta` | `Record<string, any>` | `false` | Metadata of the import. |
|
|
68
|
+
| `type` | `boolean` | `false` | If this import is a pure type import. |
|
|
69
|
+
| `typeFrom` | `string` | `false` | Use this as the `from` value when generating type declarations. |
|
|
70
|
+
| `as` | `string` | `false` | Import as this name. |
|
|
71
71
|
|
|
72
72
|
## `addImportsDir`
|
|
73
73
|
|
|
@@ -98,10 +98,10 @@ function addImportsDir (dirs: string | string[], options?: { prepend?: boolean }
|
|
|
98
98
|
|
|
99
99
|
### Parameters
|
|
100
100
|
|
|
101
|
-
| Property
|
|
102
|
-
|
|
103
|
-
| `dirs`
|
|
104
|
-
| `options`
|
|
101
|
+
| Property | Type | Required | Description |
|
|
102
|
+
|-----------|------------------------------------|----------|---------------------------------------------------------------------------------------------------------------------|
|
|
103
|
+
| `dirs` | `string \| string[]`{lang="ts"} | `true` | A string or an array of strings with the path to the directory to import from. |
|
|
104
|
+
| `options` | `{ prepend?: boolean }`{lang="ts"} | `false` | Options to pass to the import. If `prepend` is set to `true`, the imports will be prepended to the list of imports. |
|
|
105
105
|
|
|
106
106
|
## `addImportsSources`
|
|
107
107
|
|
|
@@ -138,7 +138,7 @@ function addImportsSources (importSources: ImportSource | ImportSource[]): void
|
|
|
138
138
|
|
|
139
139
|
**importSources**: An object or an array of objects with the following properties:
|
|
140
140
|
|
|
141
|
-
| Property
|
|
142
|
-
|
|
143
|
-
| `from`
|
|
144
|
-
| `imports`
|
|
141
|
+
| Property | Type | Required | Description |
|
|
142
|
+
|-----------|---------------------------------------------|----------|------------------------------------------------------------------------------------------------|
|
|
143
|
+
| `from` | `string` | `true` | Module specifier to import from. |
|
|
144
|
+
| `imports` | `PresetImport \| ImportSource[]`{lang="ts"} | `true` | An object or an array of objects, which can be import names, import objects or import sources. |
|
|
@@ -46,28 +46,28 @@ function addComponentsDir (dir: ComponentsDir, opts: { prepend?: boolean } = {})
|
|
|
46
46
|
|
|
47
47
|
`dir` An object with the following properties:
|
|
48
48
|
|
|
49
|
-
| Property
|
|
50
|
-
|
|
51
|
-
| `path`
|
|
52
|
-
| `pattern`
|
|
53
|
-
| `ignore`
|
|
54
|
-
| `prefix`
|
|
55
|
-
| `pathPrefix`
|
|
56
|
-
| `prefetch`
|
|
57
|
-
| `preload`
|
|
58
|
-
| `isAsync`
|
|
59
|
-
| `extendComponent`
|
|
60
|
-
| `global`
|
|
61
|
-
| `island`
|
|
62
|
-
| `watch`
|
|
63
|
-
| `extensions`
|
|
64
|
-
| `transpile`
|
|
49
|
+
| Property | Type | Required | Description |
|
|
50
|
+
|-------------------|------------------------------------------------------------------------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
51
|
+
| `path` | `string` | `true` | Path (absolute or relative) to the directory containing your components. You can use Nuxt aliases (~ or @) to refer to directories inside project or directly use an npm package path similar to require. |
|
|
52
|
+
| `pattern` | `string \| string[]`{lang="ts"} | `false` | Accept Pattern that will be run against specified path. |
|
|
53
|
+
| `ignore` | `string[]` | `false` | Ignore patterns that will be run against specified path. |
|
|
54
|
+
| `prefix` | `string` | `false` | Prefix all matched components with this string. |
|
|
55
|
+
| `pathPrefix` | `boolean` | `false` | Prefix component name by its path. |
|
|
56
|
+
| `prefetch` | `boolean` | `false` | These properties (prefetch/preload) are used in production to configure how components with Lazy prefix are handled by webpack via its magic comments. Learn more on [webpack documentation](https://webpack.js.org/api/module-methods/#magic-comments) |
|
|
57
|
+
| `preload` | `boolean` | `false` | These properties (prefetch/preload) are used in production to configure how components with Lazy prefix are handled by webpack via its magic comments. Learn more on [webpack documentation](https://webpack.js.org/api/module-methods/#magic-comments) |
|
|
58
|
+
| `isAsync` | `boolean` | `false` | This flag indicates, component should be loaded async (with a separate chunk) regardless of using Lazy prefix or not. |
|
|
59
|
+
| `extendComponent` | `(component: Component) => Promise<Component \| void> \| (Component \| void)`{lang="ts"} | `false` | A function that will be called for each component found in the directory. It accepts a component object and should return a component object or a promise that resolves to a component object. |
|
|
60
|
+
| `global` | `boolean` | `false` | If enabled, registers components to be globally available. |
|
|
61
|
+
| `island` | `boolean` | `false` | If enabled, registers components as islands. You can read more about islands in [`<NuxtIsland/>`](/docs/4.x/api/components/nuxt-island) component description. |
|
|
62
|
+
| `watch` | `boolean` | `false` | Watch specified path for changes, including file additions and file deletions. |
|
|
63
|
+
| `extensions` | `string[]` | `false` | Extensions supported by Nuxt builder. |
|
|
64
|
+
| `transpile` | `'auto' \| boolean`{lang="ts"} | `false` | Transpile specified path using build.transpile. If set to `'auto'`, it will set `transpile: true` if `node_modules/` is in path. |
|
|
65
65
|
|
|
66
66
|
`opts`
|
|
67
67
|
|
|
68
|
-
| Property
|
|
69
|
-
|
|
70
|
-
| `prepend`
|
|
68
|
+
| Property | Type | Required | Description |
|
|
69
|
+
|-----------|-----------|----------|------------------------------------------------------------------------------------------------------|
|
|
70
|
+
| `prepend` | `boolean` | `false` | If set to `true`, the directory will be prepended to the array with `unshift()` instead of `push()`. |
|
|
71
71
|
|
|
72
72
|
## `addComponent`
|
|
73
73
|
|
|
@@ -109,22 +109,22 @@ function addComponent (options: AddComponentOptions): void
|
|
|
109
109
|
|
|
110
110
|
`options`: An object with the following properties:
|
|
111
111
|
|
|
112
|
-
| Property
|
|
113
|
-
|
|
114
|
-
| `name`
|
|
115
|
-
| `filePath`
|
|
116
|
-
| `declarationPath`
|
|
117
|
-
| `pascalName`
|
|
118
|
-
| `kebabName`
|
|
119
|
-
| `export`
|
|
120
|
-
| `shortPath`
|
|
121
|
-
| `chunkName`
|
|
122
|
-
| `prefetch`
|
|
123
|
-
| `preload`
|
|
124
|
-
| `global`
|
|
125
|
-
| `island`
|
|
126
|
-
| `mode`
|
|
127
|
-
| `priority`
|
|
112
|
+
| Property | Type | Required | Description |
|
|
113
|
+
|-------------------|--------------------------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
114
|
+
| `name` | `string` | `true` | Component name. |
|
|
115
|
+
| `filePath` | `string` | `true` | Path to the component. |
|
|
116
|
+
| `declarationPath` | `string` | `false` | Path to component's declaration file. It is used to generate components' [type templates](/docs/4.x/api/kit/templates#addtypetemplate); if not provided, `filePath` is used instead. |
|
|
117
|
+
| `pascalName` | `string` | `false` | Pascal case component name. If not provided, it will be generated from the component name. |
|
|
118
|
+
| `kebabName` | `string` | `false` | Kebab case component name. If not provided, it will be generated from the component name. |
|
|
119
|
+
| `export` | `string` | `false` | Specify named or default export. If not provided, it will be set to `'default'`. |
|
|
120
|
+
| `shortPath` | `string` | `false` | Short path to the component. If not provided, it will be generated from the component path. |
|
|
121
|
+
| `chunkName` | `string` | `false` | Chunk name for the component. If not provided, it will be generated from the component name. |
|
|
122
|
+
| `prefetch` | `boolean` | `false` | These properties (prefetch/preload) are used in production to configure how components with Lazy prefix are handled by webpack via its magic comments. Learn more on [webpack documentation](https://webpack.js.org/api/module-methods/#magic-comments) |
|
|
123
|
+
| `preload` | `boolean` | `false` | These properties (prefetch/preload) are used in production to configure how components with Lazy prefix are handled by webpack via its magic comments. Learn more on [webpack documentation](https://webpack.js.org/api/module-methods/#magic-comments) |
|
|
124
|
+
| `global` | `boolean` | `false` | If enabled, registers component to be globally available. |
|
|
125
|
+
| `island` | `boolean` | `false` | If enabled, registers component as island. You can read more about islands in [`<NuxtIsland/>`](/docs/4.x/api/components/nuxt-island) component description. |
|
|
126
|
+
| `mode` | `'client' \| 'server' \| 'all'`{lang="ts"} | `false` | This options indicates if component should render on client, server or both. By default, it will render on both client and server. |
|
|
127
|
+
| `priority` | `number` | `false` | Priority of the component, if multiple components have the same name, the one with the highest priority will be used. |
|
|
128
128
|
|
|
129
129
|
### Examples
|
|
130
130
|
|