@nuxt/docs-nightly 4.1.3-29314777.50febbbb → 4.1.3-29316225.304409da
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 +19 -19
- package/1.getting-started/04.views.md +1 -1
- package/1.getting-started/05.assets.md +8 -2
- package/1.getting-started/06.styling.md +50 -40
- package/1.getting-started/07.routing.md +4 -4
- package/1.getting-started/08.seo-meta.md +46 -33
- package/1.getting-started/09.transitions.md +38 -33
- package/1.getting-started/10.data-fetching.md +47 -39
- package/1.getting-started/11.state-management.md +15 -8
- package/1.getting-started/12.error-handling.md +6 -4
- package/1.getting-started/13.server.md +3 -3
- package/1.getting-started/14.layers.md +18 -12
- package/1.getting-started/15.prerendering.md +24 -24
- package/1.getting-started/16.deployment.md +7 -7
- package/1.getting-started/17.testing.md +41 -41
- package/1.getting-started/18.upgrade.md +48 -66
- package/2.guide/1.directory-structure/1.app/1.components.md +36 -19
- package/2.guide/1.directory-structure/1.app/1.composables.md +7 -7
- package/2.guide/1.directory-structure/1.app/1.layouts.md +9 -5
- package/2.guide/1.directory-structure/1.app/1.middleware.md +20 -14
- package/2.guide/1.directory-structure/1.app/1.pages.md +19 -17
- package/2.guide/1.directory-structure/1.app/1.plugins.md +17 -17
- package/2.guide/1.directory-structure/1.app/1.utils.md +1 -1
- package/2.guide/1.directory-structure/1.app/3.app-config.md +6 -6
- package/2.guide/1.directory-structure/1.app/3.error.md +4 -4
- package/2.guide/1.directory-structure/1.content.md +4 -1
- package/2.guide/1.directory-structure/1.modules.md +4 -4
- package/2.guide/1.directory-structure/1.public.md +1 -1
- package/2.guide/1.directory-structure/1.server.md +28 -28
- package/2.guide/1.directory-structure/1.shared.md +1 -1
- package/2.guide/2.concepts/1.auto-imports.md +11 -11
- package/2.guide/2.concepts/2.vuejs-development.md +5 -5
- package/2.guide/2.concepts/3.rendering.md +14 -12
- package/2.guide/2.concepts/5.modules.md +2 -2
- package/2.guide/2.concepts/7.esm.md +14 -12
- package/2.guide/2.concepts/8.typescript.md +4 -4
- package/2.guide/3.going-further/1.events.md +2 -2
- package/2.guide/3.going-further/1.experimental-features.md +234 -73
- package/2.guide/3.going-further/1.features.md +44 -9
- package/2.guide/3.going-further/1.internals.md +15 -15
- package/2.guide/3.going-further/10.runtime-config.md +7 -7
- package/2.guide/3.going-further/2.hooks.md +8 -8
- package/2.guide/3.going-further/3.modules.md +76 -74
- package/2.guide/3.going-further/4.kit.md +3 -3
- package/2.guide/3.going-further/6.nuxt-app.md +1 -1
- package/2.guide/3.going-further/7.layers.md +50 -41
- package/2.guide/3.going-further/9.debugging.md +2 -2
- package/2.guide/4.recipes/1.custom-routing.md +19 -19
- package/2.guide/4.recipes/2.vite-plugin.md +3 -3
- package/2.guide/4.recipes/3.custom-usefetch.md +9 -9
- package/2.guide/4.recipes/4.sessions-and-authentication.md +33 -19
- package/2.guide/5.best-practices/performance.md +8 -8
- package/3.api/1.components/1.client-only.md +6 -3
- package/3.api/1.components/1.nuxt-client-fallback.md +9 -6
- package/3.api/1.components/11.teleports.md +4 -1
- package/3.api/1.components/12.nuxt-route-announcer.md +7 -7
- package/3.api/1.components/13.nuxt-time.md +44 -17
- package/3.api/1.components/2.nuxt-page.md +2 -2
- package/3.api/1.components/3.nuxt-layout.md +9 -4
- package/3.api/1.components/4.nuxt-link.md +38 -18
- package/3.api/1.components/6.nuxt-error-boundary.md +11 -9
- package/3.api/2.composables/on-prehydrate.md +2 -2
- package/3.api/2.composables/use-async-data.md +11 -11
- package/3.api/2.composables/use-cookie.md +26 -18
- package/3.api/2.composables/use-error.md +1 -1
- package/3.api/2.composables/use-fetch.md +13 -13
- package/3.api/2.composables/use-head-safe.md +5 -5
- package/3.api/2.composables/use-head.md +2 -2
- package/3.api/2.composables/use-hydration.md +5 -5
- package/3.api/2.composables/use-loading-indicator.md +10 -10
- package/3.api/2.composables/use-nuxt-app.md +9 -9
- package/3.api/2.composables/use-nuxt-data.md +7 -7
- package/3.api/2.composables/use-preview-mode.md +12 -15
- package/3.api/2.composables/use-request-fetch.md +1 -1
- package/3.api/2.composables/use-request-headers.md +3 -3
- package/3.api/2.composables/use-response-header.md +7 -8
- package/3.api/2.composables/use-route-announcer.md +3 -3
- package/3.api/2.composables/use-router.md +5 -3
- package/3.api/2.composables/use-runtime-config.md +6 -6
- package/3.api/2.composables/use-runtime-hook.md +1 -1
- package/3.api/2.composables/use-seo-meta.md +1 -1
- package/3.api/2.composables/use-server-seo-meta.md +1 -1
- package/3.api/2.composables/use-state.md +3 -3
- package/3.api/3.utils/$fetch.md +5 -3
- package/3.api/3.utils/abort-navigation.md +2 -2
- package/3.api/3.utils/add-route-middleware.md +3 -3
- package/3.api/3.utils/call-once.md +3 -3
- package/3.api/3.utils/clear-error.md +1 -1
- package/3.api/3.utils/clear-nuxt-data.md +2 -2
- package/3.api/3.utils/clear-nuxt-state.md +2 -2
- package/3.api/3.utils/create-error.md +1 -1
- package/3.api/3.utils/define-lazy-hydration-component.md +13 -13
- package/3.api/3.utils/define-nuxt-component.md +5 -5
- package/3.api/3.utils/define-nuxt-plugin.md +11 -11
- package/3.api/3.utils/define-nuxt-route-middleware.md +2 -2
- package/3.api/3.utils/define-page-meta.md +14 -14
- package/3.api/3.utils/define-route-rules.md +3 -3
- package/3.api/3.utils/navigate-to.md +9 -9
- package/3.api/3.utils/preload-components.md +1 -1
- package/3.api/3.utils/prerender-routes.md +2 -2
- package/3.api/3.utils/refresh-cookie.md +3 -3
- package/3.api/3.utils/refresh-nuxt-data.md +9 -4
- package/3.api/3.utils/reload-nuxt-app.md +2 -2
- package/3.api/3.utils/set-response-status.md +1 -1
- package/3.api/3.utils/show-error.md +2 -2
- package/3.api/3.utils/update-app-config.md +2 -1
- package/3.api/4.commands/prepare.md +4 -0
- package/3.api/5.kit/1.modules.md +36 -36
- package/3.api/5.kit/10.templates.md +8 -6
- package/3.api/5.kit/11.nitro.md +62 -62
- package/3.api/5.kit/12.resolving.md +2 -2
- package/3.api/5.kit/14.builder.md +1 -0
- package/3.api/5.kit/15.examples.md +2 -2
- package/3.api/5.kit/16.layers.md +26 -26
- package/3.api/5.kit/3.compatibility.md +12 -12
- package/3.api/5.kit/4.autoimports.md +12 -12
- package/3.api/5.kit/5.components.md +5 -5
- package/3.api/5.kit/6.context.md +3 -3
- package/3.api/5.kit/7.pages.md +4 -4
- package/3.api/5.kit/8.layout.md +1 -1
- package/3.api/5.kit/9.plugins.md +5 -4
- package/3.api/6.advanced/2.import-meta.md +3 -3
- package/3.api/6.nuxt-config.md +293 -858
- package/6.bridge/1.overview.md +1 -1
- package/6.bridge/10.configuration.md +2 -1
- package/6.bridge/2.typescript.md +2 -2
- package/6.bridge/3.bridge-composition-api.md +2 -2
- package/6.bridge/4.plugins-and-middleware.md +5 -5
- package/6.bridge/5.nuxt3-compatible-api.md +11 -8
- package/6.bridge/6.meta.md +15 -14
- package/6.bridge/8.nitro.md +2 -2
- package/6.bridge/9.vite.md +3 -3
- package/7.migration/2.configuration.md +17 -15
- package/7.migration/4.meta.md +17 -14
- package/7.migration/5.plugins-and-middleware.md +5 -5
- package/7.migration/6.pages-and-layouts.md +15 -11
- package/7.migration/7.component-options.md +3 -3
- package/7.migration/8.runtime-config.md +3 -3
- package/package.json +1 -1
package/3.api/6.nuxt-config.md
CHANGED
|
@@ -36,15 +36,15 @@ your alias by prefixing it with `~`.
|
|
|
36
36
|
::
|
|
37
37
|
|
|
38
38
|
**Example**:
|
|
39
|
-
```
|
|
40
|
-
import { fileURLToPath } from
|
|
39
|
+
```ts
|
|
40
|
+
import { fileURLToPath } from 'node:url'
|
|
41
41
|
|
|
42
42
|
export default defineNuxtConfig({
|
|
43
43
|
alias: {
|
|
44
44
|
'images': fileURLToPath(new URL('./assets/images', import.meta.url)),
|
|
45
45
|
'style': fileURLToPath(new URL('./assets/style', import.meta.url)),
|
|
46
|
-
'data': fileURLToPath(new URL('./assets/other/data', import.meta.url))
|
|
47
|
-
}
|
|
46
|
+
'data': fileURLToPath(new URL('./assets/other/data', import.meta.url)),
|
|
47
|
+
},
|
|
48
48
|
})
|
|
49
49
|
```
|
|
50
50
|
|
|
@@ -94,8 +94,8 @@ For example:
|
|
|
94
94
|
```ts
|
|
95
95
|
export default defineNuxtConfig({
|
|
96
96
|
app: {
|
|
97
|
-
baseURL: '/prefix/'
|
|
98
|
-
}
|
|
97
|
+
baseURL: '/prefix/',
|
|
98
|
+
},
|
|
99
99
|
})
|
|
100
100
|
```
|
|
101
101
|
|
|
@@ -126,8 +126,8 @@ For example:
|
|
|
126
126
|
```ts
|
|
127
127
|
export default defineNuxtConfig({
|
|
128
128
|
app: {
|
|
129
|
-
cdnURL: 'https://mycdn.org/'
|
|
130
|
-
}
|
|
129
|
+
cdnURL: 'https://mycdn.org/',
|
|
130
|
+
},
|
|
131
131
|
})
|
|
132
132
|
```
|
|
133
133
|
|
|
@@ -163,32 +163,34 @@ Set default configuration for `<head>` on every page.
|
|
|
163
163
|
```
|
|
164
164
|
|
|
165
165
|
**Example**:
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
```ts
|
|
167
|
+
export default defineNuxtConfig({
|
|
168
|
+
app: {
|
|
169
|
+
head: {
|
|
170
|
+
meta: [
|
|
170
171
|
// <meta name="viewport" content="width=device-width, initial-scale=1">
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
|
173
|
+
],
|
|
174
|
+
script: [
|
|
174
175
|
// <script src="https://myawesome-lib.js"></script>
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
{ src: 'https://awesome-lib.js' },
|
|
177
|
+
],
|
|
178
|
+
link: [
|
|
178
179
|
// <link rel="stylesheet" href="https://myawesome-lib.css">
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
{ rel: 'stylesheet', href: 'https://awesome-lib.css' },
|
|
181
|
+
],
|
|
182
|
+
// please note that this is an area that is likely to change
|
|
183
|
+
style: [
|
|
183
184
|
// <style>:root { color: red }</style>
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
{ textContent: ':root { color: red }' },
|
|
186
|
+
],
|
|
187
|
+
noscript: [
|
|
187
188
|
// <noscript>JavaScript is required</noscript>
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
189
|
+
{ textContent: 'JavaScript is required' },
|
|
190
|
+
],
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
})
|
|
192
194
|
```
|
|
193
195
|
|
|
194
196
|
### `keepalive`
|
|
@@ -350,10 +352,12 @@ Set to `true` to enable bundle analysis, or pass an object with options: [for we
|
|
|
350
352
|
```
|
|
351
353
|
|
|
352
354
|
**Example**:
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
355
|
+
```ts
|
|
356
|
+
export default defineNuxtConfig({
|
|
357
|
+
analyze: {
|
|
358
|
+
analyzerMode: 'static',
|
|
359
|
+
},
|
|
360
|
+
})
|
|
357
361
|
```
|
|
358
362
|
|
|
359
363
|
### `templates`
|
|
@@ -363,13 +367,17 @@ It is recommended to use `addTemplate` from `@nuxt/kit` instead of this option.
|
|
|
363
367
|
- **Type**: `array`
|
|
364
368
|
|
|
365
369
|
**Example**:
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
{
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
370
|
+
```ts
|
|
371
|
+
export default defineNuxtConfig({
|
|
372
|
+
build: {
|
|
373
|
+
templates: [
|
|
374
|
+
{
|
|
375
|
+
src: '~/modules/support/plugin.js', // `src` can be absolute or relative
|
|
376
|
+
dst: 'support.js', // `dst` is relative to project `.nuxt` dir
|
|
377
|
+
},
|
|
378
|
+
],
|
|
379
|
+
},
|
|
380
|
+
})
|
|
373
381
|
```
|
|
374
382
|
|
|
375
383
|
### `transpile`
|
|
@@ -381,8 +389,12 @@ You can also use a function to conditionally transpile. The function will receiv
|
|
|
381
389
|
- **Type**: `array`
|
|
382
390
|
|
|
383
391
|
**Example**:
|
|
384
|
-
```
|
|
385
|
-
|
|
392
|
+
```ts
|
|
393
|
+
export default defineNuxtConfig({
|
|
394
|
+
build: {
|
|
395
|
+
transpile: [({ isLegacy }) => isLegacy && 'ky'],
|
|
396
|
+
},
|
|
397
|
+
})
|
|
386
398
|
```
|
|
387
399
|
|
|
388
400
|
## buildDir
|
|
@@ -395,10 +407,10 @@ Many tools assume that `.nuxt` is a hidden directory (because it starts with a `
|
|
|
395
407
|
- **Default:** `"/<rootDir>/.nuxt"`
|
|
396
408
|
|
|
397
409
|
**Example**:
|
|
398
|
-
```
|
|
399
|
-
export default {
|
|
400
|
-
buildDir: 'nuxt-build'
|
|
401
|
-
}
|
|
410
|
+
```ts
|
|
411
|
+
export default defineNuxtConfig({
|
|
412
|
+
buildDir: 'nuxt-build',
|
|
413
|
+
})
|
|
402
414
|
```
|
|
403
415
|
|
|
404
416
|
## buildId
|
|
@@ -453,15 +465,17 @@ Nuxt will automatically guess the file type by its extension and use the appropr
|
|
|
453
465
|
- **Type**: `array`
|
|
454
466
|
|
|
455
467
|
**Example**:
|
|
456
|
-
```
|
|
457
|
-
|
|
468
|
+
```ts
|
|
469
|
+
export default defineNuxtConfig({
|
|
470
|
+
css: [
|
|
458
471
|
// Load a Node.js module directly (here it's a Sass file).
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
]
|
|
472
|
+
'bulma',
|
|
473
|
+
// CSS file in the project
|
|
474
|
+
'~/assets/css/main.css',
|
|
475
|
+
// SCSS file in the project
|
|
476
|
+
'~/assets/css/main.scss',
|
|
477
|
+
],
|
|
478
|
+
})
|
|
465
479
|
```
|
|
466
480
|
|
|
467
481
|
## debug
|
|
@@ -516,709 +530,145 @@ export default defineNuxtConfig({
|
|
|
516
530
|
devServer: {
|
|
517
531
|
https: {
|
|
518
532
|
key: './server.key',
|
|
519
|
-
cert: './server.crt'
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
})
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
### `loadingTemplate`
|
|
526
|
-
|
|
527
|
-
Template to show a loading screen
|
|
528
|
-
|
|
529
|
-
- **Type**: `function`
|
|
530
|
-
|
|
531
|
-
### `port`
|
|
532
|
-
|
|
533
|
-
Dev server listening port
|
|
534
|
-
|
|
535
|
-
- **Type**: `number`
|
|
536
|
-
- **Default:** `3000`
|
|
537
|
-
|
|
538
|
-
### `url`
|
|
539
|
-
|
|
540
|
-
Listening dev server URL.
|
|
541
|
-
|
|
542
|
-
This should not be set directly as it will always be overridden by the dev server with the full URL (for module and internal use).
|
|
543
|
-
|
|
544
|
-
- **Type**: `string`
|
|
545
|
-
- **Default:** `"http://localhost:3000"`
|
|
546
|
-
|
|
547
|
-
## devServerHandlers
|
|
548
|
-
|
|
549
|
-
Nitro development-only server handlers.
|
|
550
|
-
|
|
551
|
-
- **Type**: `array`
|
|
552
|
-
|
|
553
|
-
**See**: [Nitro server routes documentation](https://nitro.build/guide/routing)
|
|
554
|
-
|
|
555
|
-
## devtools
|
|
556
|
-
|
|
557
|
-
Enable Nuxt DevTools for development.
|
|
558
|
-
|
|
559
|
-
Breaking changes for devtools might not reflect on the version of Nuxt.
|
|
560
|
-
|
|
561
|
-
**See**: [Nuxt DevTools](https://devtools.nuxt.com/) for more information.
|
|
562
|
-
|
|
563
|
-
## dir
|
|
564
|
-
|
|
565
|
-
Customize default directory structure used by Nuxt.
|
|
566
|
-
|
|
567
|
-
It is better to stick with defaults unless needed.
|
|
568
|
-
|
|
569
|
-
### `app`
|
|
570
|
-
|
|
571
|
-
- **Type**: `string`
|
|
572
|
-
- **Default:** `"app"`
|
|
573
|
-
|
|
574
|
-
### `assets`
|
|
575
|
-
|
|
576
|
-
The assets directory (aliased as `~assets` in your build).
|
|
577
|
-
|
|
578
|
-
- **Type**: `string`
|
|
579
|
-
- **Default:** `"app/assets"`
|
|
580
|
-
|
|
581
|
-
### `layouts`
|
|
582
|
-
|
|
583
|
-
The layouts directory, each file of which will be auto-registered as a Nuxt layout.
|
|
584
|
-
|
|
585
|
-
- **Type**: `string`
|
|
586
|
-
- **Default:** `"app/layouts"`
|
|
587
|
-
|
|
588
|
-
### `middleware`
|
|
589
|
-
|
|
590
|
-
The middleware directory, each file of which will be auto-registered as a Nuxt middleware.
|
|
591
|
-
|
|
592
|
-
- **Type**: `string`
|
|
593
|
-
- **Default:** `"app/middleware"`
|
|
594
|
-
|
|
595
|
-
### `modules`
|
|
596
|
-
|
|
597
|
-
The modules directory, each file in which will be auto-registered as a Nuxt module.
|
|
598
|
-
|
|
599
|
-
- **Type**: `string`
|
|
600
|
-
- **Default:** `"modules"`
|
|
601
|
-
|
|
602
|
-
### `pages`
|
|
603
|
-
|
|
604
|
-
The directory which will be processed to auto-generate your application page routes.
|
|
605
|
-
|
|
606
|
-
- **Type**: `string`
|
|
607
|
-
- **Default:** `"app/pages"`
|
|
608
|
-
|
|
609
|
-
### `plugins`
|
|
610
|
-
|
|
611
|
-
The plugins directory, each file of which will be auto-registered as a Nuxt plugin.
|
|
612
|
-
|
|
613
|
-
- **Type**: `string`
|
|
614
|
-
- **Default:** `"app/plugins"`
|
|
615
|
-
|
|
616
|
-
### `public`
|
|
617
|
-
|
|
618
|
-
The directory containing your static files, which will be directly accessible via the Nuxt server and copied across into your `dist` folder when your app is generated.
|
|
619
|
-
|
|
620
|
-
- **Type**: `string`
|
|
621
|
-
- **Default:** `"public"`
|
|
622
|
-
|
|
623
|
-
### `shared`
|
|
624
|
-
|
|
625
|
-
The shared directory. This directory is shared between the app and the server.
|
|
626
|
-
|
|
627
|
-
- **Type**: `string`
|
|
628
|
-
- **Default:** `"shared"`
|
|
629
|
-
|
|
630
|
-
## esbuild
|
|
631
|
-
|
|
632
|
-
### `options`
|
|
633
|
-
|
|
634
|
-
Configure shared esbuild options used within Nuxt and passed to other builders, such as Vite or webpack.
|
|
635
|
-
|
|
636
|
-
#### `jsxFactory`
|
|
637
|
-
|
|
638
|
-
- **Type**: `string`
|
|
639
|
-
- **Default:** `"h"`
|
|
640
|
-
|
|
641
|
-
#### `jsxFragment`
|
|
642
|
-
|
|
643
|
-
- **Type**: `string`
|
|
644
|
-
- **Default:** `"Fragment"`
|
|
645
|
-
|
|
646
|
-
#### `target`
|
|
647
|
-
|
|
648
|
-
- **Type**: `string`
|
|
649
|
-
- **Default:** `"esnext"`
|
|
650
|
-
|
|
651
|
-
#### `tsconfigRaw`
|
|
652
|
-
|
|
653
|
-
- **Type**: `object`
|
|
654
|
-
|
|
655
|
-
## experimental
|
|
656
|
-
|
|
657
|
-
### `alwaysRunFetchOnKeyChange`
|
|
658
|
-
|
|
659
|
-
Whether to run `useFetch` when the key changes, even if it is set to `immediate: false` and it has not been triggered yet.
|
|
660
|
-
|
|
661
|
-
`useFetch` and `useAsyncData` will always run when the key changes if `immediate: true` or if it has been already triggered.
|
|
662
|
-
|
|
663
|
-
- **Type**: `boolean`
|
|
664
|
-
- **Default:** `true`
|
|
665
|
-
|
|
666
|
-
### `appManifest`
|
|
667
|
-
|
|
668
|
-
Use app manifests to respect route rules on client-side.
|
|
669
|
-
|
|
670
|
-
- **Type**: `boolean`
|
|
671
|
-
- **Default:** `true`
|
|
672
|
-
|
|
673
|
-
### `asyncContext`
|
|
674
|
-
|
|
675
|
-
Enable native async context to be accessible for nested composables
|
|
676
|
-
|
|
677
|
-
- **Type**: `boolean`
|
|
678
|
-
- **Default:** `false`
|
|
679
|
-
|
|
680
|
-
**See**: [Nuxt PR #20918](https://github.com/nuxt/nuxt/pull/20918)
|
|
681
|
-
|
|
682
|
-
### `asyncEntry`
|
|
683
|
-
|
|
684
|
-
Set to true to generate an async entry point for the Vue bundle (for module federation support).
|
|
685
|
-
|
|
686
|
-
- **Type**: `boolean`
|
|
687
|
-
- **Default:** `false`
|
|
688
|
-
|
|
689
|
-
### `browserDevtoolsTiming`
|
|
690
|
-
|
|
691
|
-
Enable timings for Nuxt application hooks in the performance panel of Chromium-based browsers.
|
|
692
|
-
|
|
693
|
-
This feature adds performance markers for Nuxt hooks, allowing you to track their execution time in the browser's Performance tab. This is particularly useful for debugging performance issues.
|
|
694
|
-
|
|
695
|
-
- **Type**: `boolean`
|
|
696
|
-
- **Default:** `false`
|
|
697
|
-
|
|
698
|
-
**Example**:
|
|
699
|
-
```ts
|
|
700
|
-
// nuxt.config.ts
|
|
701
|
-
export default defineNuxtConfig({
|
|
702
|
-
experimental: {
|
|
703
|
-
// Enable performance markers for Nuxt hooks in browser devtools
|
|
704
|
-
browserDevtoolsTiming: true
|
|
705
|
-
}
|
|
706
|
-
})
|
|
707
|
-
```
|
|
708
|
-
|
|
709
|
-
**See**: [PR #29922](https://github.com/nuxt/nuxt/pull/29922)
|
|
710
|
-
|
|
711
|
-
**See**: [Chrome DevTools Performance API](https://developer.chrome.com/docs/devtools/performance/extension#tracks)
|
|
712
|
-
|
|
713
|
-
### `buildCache`
|
|
714
|
-
|
|
715
|
-
Cache Nuxt/Nitro build artifacts based on a hash of the configuration and source files.
|
|
716
|
-
|
|
717
|
-
This only works for source files within `srcDir` and `serverDir` for the Vue/Nitro parts of your app.
|
|
718
|
-
|
|
719
|
-
- **Type**: `boolean`
|
|
720
|
-
- **Default:** `false`
|
|
721
|
-
|
|
722
|
-
### `checkOutdatedBuildInterval`
|
|
723
|
-
|
|
724
|
-
Set the time interval (in ms) to check for new builds. Disabled when `experimental.appManifest` is `false`.
|
|
725
|
-
|
|
726
|
-
Set to `false` to disable.
|
|
727
|
-
|
|
728
|
-
- **Type**: `number`
|
|
729
|
-
- **Default:** `3600000`
|
|
730
|
-
|
|
731
|
-
### `clientFallback`
|
|
732
|
-
|
|
733
|
-
Whether to enable the experimental `<NuxtClientFallback>` component for rendering content on the client if there's an error in SSR.
|
|
734
|
-
|
|
735
|
-
- **Type**: `boolean`
|
|
736
|
-
- **Default:** `false`
|
|
737
|
-
|
|
738
|
-
### `clientNodeCompat`
|
|
739
|
-
|
|
740
|
-
Automatically polyfill Node.js imports in the client build using `unenv`.
|
|
741
|
-
|
|
742
|
-
- **Type**: `boolean`
|
|
743
|
-
- **Default:** `false`
|
|
744
|
-
|
|
745
|
-
**See**: [unenv](https://github.com/unjs/unenv)
|
|
746
|
-
|
|
747
|
-
**Note:** To make globals like `Buffer` work in the browser, you need to manually inject them.
|
|
748
|
-
|
|
749
|
-
```ts
|
|
750
|
-
import { Buffer } from 'node:buffer'
|
|
751
|
-
|
|
752
|
-
globalThis.Buffer = globalThis.Buffer || Buffer
|
|
753
|
-
```
|
|
754
|
-
|
|
755
|
-
### `compileTemplate`
|
|
756
|
-
|
|
757
|
-
Whether to use `lodash.template` to compile Nuxt templates.
|
|
758
|
-
|
|
759
|
-
This flag will be removed with the release of v4 and exists only for advance testing within Nuxt v3.12+ or in [the nightly release channel](/docs/4.x/guide/going-further/nightly-release-channel).
|
|
760
|
-
|
|
761
|
-
- **Type**: `boolean`
|
|
762
|
-
- **Default:** `true`
|
|
763
|
-
|
|
764
|
-
### `componentIslands`
|
|
765
|
-
|
|
766
|
-
Experimental component islands support with `<NuxtIsland>` and `.island.vue` files.
|
|
767
|
-
|
|
768
|
-
By default it is set to 'auto', which means it will be enabled only when there are islands, server components or server pages in your app.
|
|
769
|
-
|
|
770
|
-
- **Type**: `string`
|
|
771
|
-
- **Default:** `"auto"`
|
|
772
|
-
|
|
773
|
-
### `configSchema`
|
|
774
|
-
|
|
775
|
-
Config schema support
|
|
776
|
-
|
|
777
|
-
- **Type**: `boolean`
|
|
778
|
-
- **Default:** `true`
|
|
779
|
-
|
|
780
|
-
**See**: [Nuxt Issue #15592](https://github.com/nuxt/nuxt/issues/15592)
|
|
781
|
-
|
|
782
|
-
### `cookieStore`
|
|
783
|
-
|
|
784
|
-
Enables CookieStore support to listen for cookie updates (if supported by the browser) and refresh `useCookie` ref values.
|
|
785
|
-
|
|
786
|
-
- **Type**: `boolean`
|
|
787
|
-
- **Default:** `true`
|
|
788
|
-
|
|
789
|
-
**See**: [CookieStore](https://developer.mozilla.org/en-US/docs/Web/API/CookieStore)
|
|
790
|
-
|
|
791
|
-
### `crossOriginPrefetch`
|
|
792
|
-
|
|
793
|
-
Enable cross-origin prefetch using the Speculation Rules API.
|
|
794
|
-
|
|
795
|
-
- **Type**: `boolean`
|
|
796
|
-
- **Default:** `false`
|
|
797
|
-
|
|
798
|
-
### `debugModuleMutation`
|
|
799
|
-
|
|
800
|
-
Record mutations to `nuxt.options` in module context, helping to debug configuration changes made by modules during the Nuxt initialization phase.
|
|
801
|
-
|
|
802
|
-
When enabled, Nuxt will track which modules modify configuration options, making it easier to trace unexpected configuration changes.
|
|
803
|
-
|
|
804
|
-
- **Type**: `boolean`
|
|
805
|
-
- **Default:** `false`
|
|
806
|
-
|
|
807
|
-
**Example**:
|
|
808
|
-
```ts
|
|
809
|
-
// nuxt.config.ts
|
|
810
|
-
export default defineNuxtConfig({
|
|
811
|
-
experimental: {
|
|
812
|
-
// Enable tracking of config mutations by modules
|
|
813
|
-
debugModuleMutation: true
|
|
814
|
-
}
|
|
815
|
-
})
|
|
816
|
-
```
|
|
817
|
-
|
|
818
|
-
**See**: [PR #30555](https://github.com/nuxt/nuxt/pull/30555)
|
|
819
|
-
|
|
820
|
-
### `decorators`
|
|
821
|
-
|
|
822
|
-
Enable the use of experimental decorators in Nuxt and Nitro.
|
|
823
|
-
|
|
824
|
-
- **Type**: `boolean`
|
|
825
|
-
- **Default:** `false`
|
|
826
|
-
|
|
827
|
-
**See**: https://github.com/tc39/proposal-decorators
|
|
828
|
-
|
|
829
|
-
### `defaults`
|
|
830
|
-
|
|
831
|
-
This allows specifying the default options for core Nuxt components and composables.
|
|
832
|
-
|
|
833
|
-
These options will likely be moved elsewhere in the future, such as into `app.config` or into the `app/` directory.
|
|
834
|
-
|
|
835
|
-
#### `nuxtLink`
|
|
836
|
-
|
|
837
|
-
##### `componentName`
|
|
838
|
-
|
|
839
|
-
- **Type**: `string`
|
|
840
|
-
- **Default:** `"NuxtLink"`
|
|
841
|
-
|
|
842
|
-
##### `prefetch`
|
|
843
|
-
|
|
844
|
-
- **Type**: `boolean`
|
|
845
|
-
- **Default:** `true`
|
|
846
|
-
|
|
847
|
-
##### `prefetchOn`
|
|
848
|
-
|
|
849
|
-
###### `visibility`
|
|
850
|
-
|
|
851
|
-
- **Type**: `boolean`
|
|
852
|
-
- **Default:** `true`
|
|
853
|
-
|
|
854
|
-
#### `useAsyncData`
|
|
855
|
-
|
|
856
|
-
Options that apply to `useAsyncData` (and also therefore `useFetch`)
|
|
857
|
-
|
|
858
|
-
##### `deep`
|
|
859
|
-
|
|
860
|
-
- **Type**: `boolean`
|
|
861
|
-
- **Default:** `true`
|
|
862
|
-
|
|
863
|
-
##### `errorValue`
|
|
864
|
-
|
|
865
|
-
- **Type**: `string`
|
|
866
|
-
- **Default:** `"null"`
|
|
867
|
-
|
|
868
|
-
##### `value`
|
|
869
|
-
|
|
870
|
-
- **Type**: `string`
|
|
871
|
-
- **Default:** `"null"`
|
|
872
|
-
|
|
873
|
-
#### `useFetch`
|
|
874
|
-
|
|
875
|
-
### `emitRouteChunkError`
|
|
876
|
-
|
|
877
|
-
Emit `app:chunkError` hook when there is an error loading vite/webpack chunks.
|
|
878
|
-
|
|
879
|
-
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`).
|
|
880
|
-
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).
|
|
881
|
-
You can disable automatic handling by setting this to `false`, or handle chunk errors manually by setting it to `manual`.
|
|
882
|
-
|
|
883
|
-
- **Type**: `string`
|
|
884
|
-
- **Default:** `"automatic"`
|
|
885
|
-
|
|
886
|
-
**See**: [Nuxt PR #19038](https://github.com/nuxt/nuxt/pull/19038)
|
|
887
|
-
|
|
888
|
-
### `enforceModuleCompatibility`
|
|
889
|
-
|
|
890
|
-
Whether Nuxt should stop if a Nuxt module is incompatible.
|
|
891
|
-
|
|
892
|
-
- **Type**: `boolean`
|
|
893
|
-
- **Default:** `false`
|
|
894
|
-
|
|
895
|
-
### `externalVue`
|
|
896
|
-
|
|
897
|
-
Externalize `vue`, `@vue/*` and `vue-router` when building.
|
|
898
|
-
|
|
899
|
-
- **Type**: `boolean`
|
|
900
|
-
- **Default:** `true`
|
|
901
|
-
|
|
902
|
-
**See**: [Nuxt Issue #13632](https://github.com/nuxt/nuxt/issues/13632)
|
|
903
|
-
|
|
904
|
-
### `extraPageMetaExtractionKeys`
|
|
905
|
-
|
|
906
|
-
Configure additional keys to extract from the page metadata when using `scanPageMeta`.
|
|
907
|
-
|
|
908
|
-
This allows modules to access additional metadata from the page metadata. It's recommended to augment the NuxtPage types with your keys.
|
|
909
|
-
|
|
910
|
-
- **Type**: `array`
|
|
911
|
-
|
|
912
|
-
### `granularCachedData`
|
|
913
|
-
|
|
914
|
-
Whether to call and use the result from `getCachedData` on manual refresh for `useAsyncData` and `useFetch`.
|
|
915
|
-
|
|
916
|
-
- **Type**: `boolean`
|
|
917
|
-
- **Default:** `false`
|
|
918
|
-
|
|
919
|
-
### `headNext`
|
|
920
|
-
|
|
921
|
-
Use new experimental head optimisations:
|
|
922
|
-
|
|
923
|
-
- Add the capo.js head plugin in order to render tags in of the head in a more performant way. - Uses the hash hydration plugin to reduce initial hydration
|
|
924
|
-
|
|
925
|
-
- **Type**: `boolean`
|
|
926
|
-
- **Default:** `true`
|
|
927
|
-
|
|
928
|
-
**See**: [Nuxt Discussion #22632](https://github.com/nuxt/nuxt/discussions/22632)
|
|
929
|
-
|
|
930
|
-
### `inlineRouteRules`
|
|
931
|
-
|
|
932
|
-
Allow defining `routeRules` directly within your `~/pages` directory using `defineRouteRules`.
|
|
933
|
-
|
|
934
|
-
Rules are converted (based on the path) and applied for server requests. For example, a rule defined in `~/pages/foo/bar.vue` will be applied to `/foo/bar` requests. A rule in `~/pages/foo/[id].vue` will be applied to `/foo/**` requests.
|
|
935
|
-
For more control, such as if you are using a custom `path` or `alias` set in the page's `definePageMeta`, you should set `routeRules` directly within your `nuxt.config`.
|
|
936
|
-
|
|
937
|
-
- **Type**: `boolean`
|
|
938
|
-
- **Default:** `false`
|
|
939
|
-
|
|
940
|
-
### `lazyHydration`
|
|
941
|
-
|
|
942
|
-
Enable automatic configuration of hydration strategies for `<Lazy>` components.
|
|
943
|
-
|
|
944
|
-
This feature intelligently determines when to hydrate lazy components based on visibility, idle time, or other triggers, improving performance by deferring hydration of components until they're needed.
|
|
945
|
-
|
|
946
|
-
- **Type**: `boolean`
|
|
947
|
-
- **Default:** `true`
|
|
948
|
-
|
|
949
|
-
**Example**:
|
|
950
|
-
```ts
|
|
951
|
-
// nuxt.config.ts
|
|
952
|
-
export default defineNuxtConfig({
|
|
953
|
-
experimental: {
|
|
954
|
-
lazyHydration: true // Enable smart hydration strategies for Lazy components
|
|
955
|
-
}
|
|
956
|
-
})
|
|
957
|
-
|
|
958
|
-
// In your Vue components
|
|
959
|
-
<template>
|
|
960
|
-
<Lazy>
|
|
961
|
-
<ExpensiveComponent />
|
|
962
|
-
</Lazy>
|
|
963
|
-
</template>
|
|
964
|
-
```
|
|
965
|
-
|
|
966
|
-
**See**: [PR #26468](https://github.com/nuxt/nuxt/pull/26468)
|
|
967
|
-
|
|
968
|
-
### `localLayerAliases`
|
|
969
|
-
|
|
970
|
-
Resolve `~`, `~~`, `@` and `@@` aliases located within layers with respect to their layer source and root directories.
|
|
971
|
-
|
|
972
|
-
- **Type**: `boolean`
|
|
973
|
-
- **Default:** `true`
|
|
974
|
-
|
|
975
|
-
### `navigationRepaint`
|
|
976
|
-
|
|
977
|
-
Wait for a single animation frame before navigation, which gives an opportunity for the browser to repaint, acknowledging user interaction.
|
|
978
|
-
|
|
979
|
-
It can reduce INP when navigating on prerendered routes.
|
|
980
|
-
|
|
981
|
-
- **Type**: `boolean`
|
|
982
|
-
- **Default:** `true`
|
|
983
|
-
|
|
984
|
-
### `noVueServer`
|
|
985
|
-
|
|
986
|
-
Disable vue server renderer endpoint within nitro.
|
|
987
|
-
|
|
988
|
-
- **Type**: `boolean`
|
|
989
|
-
- **Default:** `false`
|
|
990
|
-
|
|
991
|
-
### `normalizeComponentNames`
|
|
992
|
-
|
|
993
|
-
Ensure that auto-generated Vue component names match the full component name you would use to auto-import the component.
|
|
994
|
-
|
|
995
|
-
- **Type**: `boolean`
|
|
996
|
-
- **Default:** `false`
|
|
997
|
-
|
|
998
|
-
### `parseErrorData`
|
|
999
|
-
|
|
1000
|
-
Whether to parse `error.data` when rendering a server error page.
|
|
1001
|
-
|
|
1002
|
-
- **Type**: `boolean`
|
|
1003
|
-
- **Default:** `false`
|
|
1004
|
-
|
|
1005
|
-
### `payloadExtraction`
|
|
1006
|
-
|
|
1007
|
-
When this option is enabled (by default) payload of pages that are prerendered are extracted
|
|
1008
|
-
|
|
1009
|
-
- **Type**: `boolean`
|
|
1010
|
-
- **Default:** `true`
|
|
1011
|
-
|
|
1012
|
-
### `pendingWhenIdle`
|
|
1013
|
-
|
|
1014
|
-
For `useAsyncData` and `useFetch`, whether `pending` should be `true` when data has not yet started to be fetched.
|
|
1015
|
-
|
|
1016
|
-
- **Type**: `boolean`
|
|
1017
|
-
- **Default:** `true`
|
|
1018
|
-
|
|
1019
|
-
### `polyfillVueUseHead`
|
|
1020
|
-
|
|
1021
|
-
Whether or not to add a compatibility layer for modules, plugins or user code relying on the old `@vueuse/head` API.
|
|
1022
|
-
|
|
1023
|
-
This is disabled to reduce the client-side bundle by ~0.5kb.
|
|
1024
|
-
|
|
1025
|
-
- **Type**: `boolean`
|
|
1026
|
-
- **Default:** `false`
|
|
1027
|
-
|
|
1028
|
-
### `purgeCachedData`
|
|
1029
|
-
|
|
1030
|
-
Whether to clean up Nuxt static and asyncData caches on route navigation.
|
|
1031
|
-
|
|
1032
|
-
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.
|
|
1033
|
-
|
|
1034
|
-
- **Type**: `boolean`
|
|
1035
|
-
- **Default:** `true`
|
|
1036
|
-
|
|
1037
|
-
**Example**:
|
|
1038
|
-
```ts
|
|
1039
|
-
// nuxt.config.ts
|
|
1040
|
-
export default defineNuxtConfig({
|
|
1041
|
-
experimental: {
|
|
1042
|
-
// Disable automatic cache cleanup (default is true)
|
|
1043
|
-
purgeCachedData: false
|
|
1044
|
-
}
|
|
1045
|
-
})
|
|
1046
|
-
```
|
|
1047
|
-
|
|
1048
|
-
**See**: [PR #31379](https://github.com/nuxt/nuxt/pull/31379)
|
|
1049
|
-
|
|
1050
|
-
### `relativeWatchPaths`
|
|
1051
|
-
|
|
1052
|
-
Whether to provide relative paths in the `builder:watch` hook.
|
|
1053
|
-
|
|
1054
|
-
This flag will be removed with the release of v4 and exists only for advance testing within Nuxt v3.12+ or in [the nightly release channel](/docs/4.x/guide/going-further/nightly-release-channel).
|
|
1055
|
-
|
|
1056
|
-
- **Type**: `boolean`
|
|
1057
|
-
- **Default:** `true`
|
|
1058
|
-
|
|
1059
|
-
### `renderJsonPayloads`
|
|
1060
|
-
|
|
1061
|
-
Render JSON payloads with support for revivifying complex types.
|
|
1062
|
-
|
|
1063
|
-
- **Type**: `boolean`
|
|
1064
|
-
- **Default:** `true`
|
|
533
|
+
cert: './server.crt',
|
|
534
|
+
},
|
|
535
|
+
},
|
|
536
|
+
})
|
|
537
|
+
```
|
|
1065
538
|
|
|
1066
|
-
### `
|
|
539
|
+
### `loadingTemplate`
|
|
1067
540
|
|
|
1068
|
-
|
|
541
|
+
Template to show a loading screen
|
|
1069
542
|
|
|
1070
|
-
- **Type**: `
|
|
1071
|
-
- **Default:** `true`
|
|
543
|
+
- **Type**: `function`
|
|
1072
544
|
|
|
1073
|
-
### `
|
|
545
|
+
### `port`
|
|
1074
546
|
|
|
1075
|
-
|
|
547
|
+
Dev server listening port
|
|
1076
548
|
|
|
1077
|
-
- **Type**: `
|
|
1078
|
-
- **Default:** `
|
|
549
|
+
- **Type**: `number`
|
|
550
|
+
- **Default:** `3000`
|
|
1079
551
|
|
|
1080
|
-
### `
|
|
552
|
+
### `url`
|
|
1081
553
|
|
|
1082
|
-
|
|
554
|
+
Listening dev server URL.
|
|
1083
555
|
|
|
1084
|
-
|
|
1085
|
-
Consider carefully before enabling this as it can cause unexpected behavior, and consider providing explicit keys to `useState` as auto-generated keys may not match across builds.
|
|
556
|
+
This should not be set directly as it will always be overridden by the dev server with the full URL (for module and internal use).
|
|
1086
557
|
|
|
1087
|
-
- **Type**: `
|
|
1088
|
-
- **Default:** `
|
|
558
|
+
- **Type**: `string`
|
|
559
|
+
- **Default:** `"http://localhost:3000"`
|
|
1089
560
|
|
|
1090
|
-
|
|
561
|
+
## devServerHandlers
|
|
1091
562
|
|
|
1092
|
-
|
|
563
|
+
Nitro development-only server handlers.
|
|
1093
564
|
|
|
1094
|
-
|
|
565
|
+
- **Type**: `array`
|
|
1095
566
|
|
|
1096
|
-
|
|
1097
|
-
- **Default:** `true`
|
|
567
|
+
**See**: [Nitro server routes documentation](https://nitro.build/guide/routing)
|
|
1098
568
|
|
|
1099
|
-
|
|
569
|
+
## devtools
|
|
1100
570
|
|
|
1101
|
-
|
|
571
|
+
Enable Nuxt DevTools for development.
|
|
1102
572
|
|
|
1103
|
-
|
|
573
|
+
Breaking changes for devtools might not reflect on the version of Nuxt.
|
|
1104
574
|
|
|
1105
|
-
|
|
575
|
+
**See**: [Nuxt DevTools](https://devtools.nuxt.com/) for more information.
|
|
1106
576
|
|
|
1107
|
-
|
|
1108
|
-
- **Default:** `false`
|
|
577
|
+
## dir
|
|
1109
578
|
|
|
1110
|
-
|
|
1111
|
-
```ts
|
|
1112
|
-
// This would be unsafe in a dynamic page (e.g. `[slug].vue`) because the route slug makes a difference
|
|
1113
|
-
// to the data fetched, but Nuxt can't know that because it's not reflected in the key.
|
|
1114
|
-
const route = useRoute()
|
|
1115
|
-
const { data } = await useAsyncData(async () => {
|
|
1116
|
-
return await $fetch(`/api/my-page/${route.params.slug}`)
|
|
1117
|
-
})
|
|
1118
|
-
// Instead, you should use a key that uniquely identifies the data fetched.
|
|
1119
|
-
const { data } = await useAsyncData(route.params.slug, async () => {
|
|
1120
|
-
return await $fetch(`/api/my-page/${route.params.slug}`)
|
|
1121
|
-
})
|
|
1122
|
-
```
|
|
579
|
+
Customize default directory structure used by Nuxt.
|
|
1123
580
|
|
|
1124
|
-
|
|
581
|
+
It is better to stick with defaults unless needed.
|
|
1125
582
|
|
|
1126
|
-
|
|
583
|
+
### `app`
|
|
1127
584
|
|
|
1128
585
|
- **Type**: `string`
|
|
1129
|
-
- **Default:** `"
|
|
586
|
+
- **Default:** `"app"`
|
|
1130
587
|
|
|
1131
|
-
|
|
588
|
+
### `assets`
|
|
1132
589
|
|
|
1133
|
-
|
|
590
|
+
The assets directory (aliased as `~assets` in your build).
|
|
1134
591
|
|
|
1135
|
-
|
|
592
|
+
- **Type**: `string`
|
|
593
|
+
- **Default:** `"app/assets"`
|
|
1136
594
|
|
|
1137
|
-
|
|
595
|
+
### `layouts`
|
|
1138
596
|
|
|
1139
|
-
-
|
|
1140
|
-
- **Default:** `true`
|
|
597
|
+
The layouts directory, each file of which will be auto-registered as a Nuxt layout.
|
|
1141
598
|
|
|
1142
|
-
**
|
|
1143
|
-
|
|
1144
|
-
// nuxt.config.ts
|
|
1145
|
-
export default defineNuxtConfig({
|
|
1146
|
-
experimental: {
|
|
1147
|
-
// Disable template import resolution from module path
|
|
1148
|
-
templateImportResolution: false
|
|
1149
|
-
}
|
|
1150
|
-
})
|
|
1151
|
-
```
|
|
599
|
+
- **Type**: `string`
|
|
600
|
+
- **Default:** `"app/layouts"`
|
|
1152
601
|
|
|
1153
|
-
|
|
602
|
+
### `middleware`
|
|
1154
603
|
|
|
1155
|
-
|
|
604
|
+
The middleware directory, each file of which will be auto-registered as a Nuxt middleware.
|
|
1156
605
|
|
|
1157
|
-
|
|
606
|
+
- **Type**: `string`
|
|
607
|
+
- **Default:** `"app/middleware"`
|
|
1158
608
|
|
|
1159
|
-
|
|
609
|
+
### `modules`
|
|
1160
610
|
|
|
1161
|
-
-
|
|
1162
|
-
- **Default:** `true`
|
|
611
|
+
The modules directory, each file in which will be auto-registered as a Nuxt module.
|
|
1163
612
|
|
|
1164
|
-
|
|
613
|
+
- **Type**: `string`
|
|
614
|
+
- **Default:** `"modules"`
|
|
1165
615
|
|
|
1166
|
-
|
|
616
|
+
### `pages`
|
|
1167
617
|
|
|
1168
|
-
|
|
618
|
+
The directory which will be processed to auto-generate your application page routes.
|
|
1169
619
|
|
|
1170
|
-
- **Type**: `
|
|
1171
|
-
- **Default:** `
|
|
620
|
+
- **Type**: `string`
|
|
621
|
+
- **Default:** `"app/pages"`
|
|
1172
622
|
|
|
1173
|
-
### `
|
|
623
|
+
### `plugins`
|
|
1174
624
|
|
|
1175
|
-
|
|
625
|
+
The plugins directory, each file of which will be auto-registered as a Nuxt plugin.
|
|
1176
626
|
|
|
1177
|
-
- **Type**: `
|
|
1178
|
-
- **Default:** `
|
|
627
|
+
- **Type**: `string`
|
|
628
|
+
- **Default:** `"app/plugins"`
|
|
1179
629
|
|
|
1180
|
-
|
|
630
|
+
### `public`
|
|
1181
631
|
|
|
1182
|
-
|
|
632
|
+
The directory containing your static files, which will be directly accessible via the Nuxt server and copied across into your `dist` folder when your app is generated.
|
|
1183
633
|
|
|
1184
|
-
|
|
634
|
+
- **Type**: `string`
|
|
635
|
+
- **Default:** `"public"`
|
|
1185
636
|
|
|
1186
|
-
|
|
1187
|
-
- **Default:** `false`
|
|
637
|
+
### `shared`
|
|
1188
638
|
|
|
1189
|
-
|
|
639
|
+
The shared directory. This directory is shared between the app and the server.
|
|
1190
640
|
|
|
1191
|
-
|
|
641
|
+
- **Type**: `string`
|
|
642
|
+
- **Default:** `"shared"`
|
|
1192
643
|
|
|
1193
|
-
|
|
1194
|
-
|
|
644
|
+
## esbuild
|
|
645
|
+
|
|
646
|
+
### `options`
|
|
1195
647
|
|
|
1196
|
-
|
|
648
|
+
Configure shared esbuild options used within Nuxt and passed to other builders, such as Vite or webpack.
|
|
1197
649
|
|
|
1198
|
-
|
|
650
|
+
#### `jsxFactory`
|
|
1199
651
|
|
|
1200
|
-
|
|
652
|
+
- **Type**: `string`
|
|
653
|
+
- **Default:** `"h"`
|
|
1201
654
|
|
|
1202
|
-
|
|
1203
|
-
You can set this instead to `parcel` to use `@parcel/watcher`, which may improve performance in large projects or on Windows platforms.
|
|
1204
|
-
You can also set this to `chokidar` to watch all files in your source directory.
|
|
655
|
+
#### `jsxFragment`
|
|
1205
656
|
|
|
1206
657
|
- **Type**: `string`
|
|
1207
|
-
- **Default:** `"
|
|
658
|
+
- **Default:** `"Fragment"`
|
|
1208
659
|
|
|
1209
|
-
|
|
660
|
+
#### `target`
|
|
1210
661
|
|
|
1211
|
-
**
|
|
662
|
+
- **Type**: `string`
|
|
663
|
+
- **Default:** `"esnext"`
|
|
1212
664
|
|
|
1213
|
-
|
|
665
|
+
#### `tsconfigRaw`
|
|
1214
666
|
|
|
1215
|
-
|
|
667
|
+
- **Type**: `object`
|
|
1216
668
|
|
|
1217
|
-
|
|
1218
|
-
- **Default:** `false`
|
|
669
|
+
## experimental
|
|
1219
670
|
|
|
1220
|
-
::
|
|
1221
|
-
**Note**: nginx does not support 103 Early hints in the current version.
|
|
671
|
+
::read-more{to="/docs/4.x/guide/going-further/experimental-features"} Learn more about Nuxt's experimental features.
|
|
1222
672
|
::
|
|
1223
673
|
|
|
1224
674
|
## extends
|
|
@@ -1251,65 +701,13 @@ The extensions that should be resolved by the Nuxt resolver.
|
|
|
1251
701
|
|
|
1252
702
|
## features
|
|
1253
703
|
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
### `devLogs`
|
|
1257
|
-
|
|
1258
|
-
Stream server logs to the client as you are developing. These logs can be handled in the `dev:ssr-logs` hook.
|
|
1259
|
-
|
|
1260
|
-
If set to `silent`, the logs will not be printed to the browser console.
|
|
1261
|
-
|
|
1262
|
-
- **Type**: `boolean`
|
|
1263
|
-
- **Default:** `false`
|
|
1264
|
-
|
|
1265
|
-
### `inlineStyles`
|
|
1266
|
-
|
|
1267
|
-
Inline styles when rendering HTML (currently vite only).
|
|
1268
|
-
|
|
1269
|
-
You can also pass a function that receives the path of a Vue component and returns a boolean indicating whether to inline the styles for that component.
|
|
1270
|
-
|
|
1271
|
-
- **Type**: `boolean`
|
|
1272
|
-
- **Default:** `(id) => id.includes('.vue')`
|
|
1273
|
-
|
|
1274
|
-
### `noScripts`
|
|
1275
|
-
|
|
1276
|
-
Turn off rendering of Nuxt scripts and JS resource hints. You can also disable scripts more granularly within `routeRules`.
|
|
1277
|
-
|
|
1278
|
-
If set to 'production' or `true`, JS will be disabled in production mode only.
|
|
1279
|
-
|
|
1280
|
-
- **Type**: `boolean`
|
|
1281
|
-
- **Default:** `false`
|
|
704
|
+
::read-more{to="/docs/4.x/guide/going-further/features#features"} Learn more about Nuxt's opt-in features.
|
|
705
|
+
::
|
|
1282
706
|
|
|
1283
707
|
## future
|
|
1284
708
|
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
### `compatibilityVersion`
|
|
1288
|
-
|
|
1289
|
-
This is used for enabling early access to Nuxt features or flags.
|
|
1290
|
-
|
|
1291
|
-
It is not configurable yet in Nuxt 4, but once we begin merging breaking changes for v5, it will be possible to enable it.
|
|
1292
|
-
|
|
1293
|
-
### `multiApp`
|
|
1294
|
-
|
|
1295
|
-
This enables early access to the experimental multi-app support.
|
|
1296
|
-
|
|
1297
|
-
- **Type**: `boolean`
|
|
1298
|
-
- **Default:** `false`
|
|
1299
|
-
|
|
1300
|
-
**See**: [Nuxt Issue #21635](https://github.com/nuxt/nuxt/issues/21635)
|
|
1301
|
-
|
|
1302
|
-
### `typescriptBundlerResolution`
|
|
1303
|
-
|
|
1304
|
-
This enables 'Bundler' module resolution mode for TypeScript, which is the recommended setting for frameworks like Nuxt and Vite.
|
|
1305
|
-
|
|
1306
|
-
It improves type support when using modern libraries with `exports`.
|
|
1307
|
-
You can set it to false to use the legacy 'Node' mode, which is the default for TypeScript.
|
|
1308
|
-
|
|
1309
|
-
- **Type**: `boolean`
|
|
1310
|
-
- **Default:** `true`
|
|
1311
|
-
|
|
1312
|
-
**See**: [TypeScript PR implementing `bundler` module resolution](https://github.com/microsoft/TypeScript/pull/51669)
|
|
709
|
+
::read-more{to="/docs/4.x/guide/going-further/features#features"} Learn more about opting-in to new features that will become default in a future (possibly major) version of the framework,
|
|
710
|
+
::
|
|
1313
711
|
|
|
1314
712
|
## hooks
|
|
1315
713
|
|
|
@@ -1319,22 +717,23 @@ Internally, hooks follow a naming pattern using colons (e.g., build:done).
|
|
|
1319
717
|
For ease of configuration, you can also structure them as an hierarchical object in `nuxt.config` (as below).
|
|
1320
718
|
|
|
1321
719
|
**Example**:
|
|
1322
|
-
```
|
|
720
|
+
```ts
|
|
1323
721
|
import fs from 'node:fs'
|
|
1324
722
|
import path from 'node:path'
|
|
1325
|
-
|
|
723
|
+
|
|
724
|
+
export default defineNuxtConfig({
|
|
1326
725
|
hooks: {
|
|
1327
726
|
build: {
|
|
1328
|
-
done(builder) {
|
|
727
|
+
done (builder) {
|
|
1329
728
|
const extraFilePath = path.join(
|
|
1330
729
|
builder.nuxt.options.buildDir,
|
|
1331
|
-
'extra-file'
|
|
730
|
+
'extra-file',
|
|
1332
731
|
)
|
|
1333
732
|
fs.writeFileSync(extraFilePath, 'Something extra')
|
|
1334
|
-
}
|
|
1335
|
-
}
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
733
|
+
},
|
|
734
|
+
},
|
|
735
|
+
},
|
|
736
|
+
})
|
|
1338
737
|
```
|
|
1339
738
|
|
|
1340
739
|
## ignore
|
|
@@ -1363,10 +762,12 @@ Pass options directly to `node-ignore` (which is used by Nuxt to ignore files).
|
|
|
1363
762
|
**See**: [node-ignore](https://github.com/kaelzhang/node-ignore)
|
|
1364
763
|
|
|
1365
764
|
**Example**:
|
|
1366
|
-
```
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
765
|
+
```ts
|
|
766
|
+
export default defineNuxtConfig({
|
|
767
|
+
ignoreOptions: {
|
|
768
|
+
ignorecase: false,
|
|
769
|
+
},
|
|
770
|
+
})
|
|
1370
771
|
```
|
|
1371
772
|
|
|
1372
773
|
## ignorePrefix
|
|
@@ -1389,11 +790,13 @@ An array of custom directories that will be auto-imported. Note that this option
|
|
|
1389
790
|
- **Type**: `array`
|
|
1390
791
|
|
|
1391
792
|
**Example**:
|
|
1392
|
-
```
|
|
1393
|
-
|
|
793
|
+
```ts
|
|
794
|
+
export default defineNuxtConfig({
|
|
795
|
+
imports: {
|
|
1394
796
|
// Auto-import pinia stores defined in `~/stores`
|
|
1395
|
-
|
|
1396
|
-
}
|
|
797
|
+
dirs: ['stores'],
|
|
798
|
+
},
|
|
799
|
+
})
|
|
1397
800
|
```
|
|
1398
801
|
|
|
1399
802
|
### `global`
|
|
@@ -1432,17 +835,19 @@ directory are executed, and they load in alphabetical order.
|
|
|
1432
835
|
::
|
|
1433
836
|
|
|
1434
837
|
**Example**:
|
|
1435
|
-
```
|
|
1436
|
-
|
|
838
|
+
```ts
|
|
839
|
+
export default defineNuxtConfig({
|
|
840
|
+
modules: [
|
|
1437
841
|
// Using package name
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
]
|
|
842
|
+
'@nuxt/scripts',
|
|
843
|
+
// Relative to your project srcDir
|
|
844
|
+
'~/custom-modules/awesome.js',
|
|
845
|
+
// Providing options
|
|
846
|
+
['@nuxtjs/google-analytics', { ua: 'X1234567' }],
|
|
847
|
+
// Inline definition
|
|
848
|
+
function () {},
|
|
849
|
+
],
|
|
850
|
+
})
|
|
1446
851
|
```
|
|
1447
852
|
|
|
1448
853
|
## modulesDir
|
|
@@ -1461,10 +866,10 @@ Setting this field may be necessary if your project is organized as a yarn works
|
|
|
1461
866
|
```
|
|
1462
867
|
|
|
1463
868
|
**Example**:
|
|
1464
|
-
```
|
|
1465
|
-
export default {
|
|
1466
|
-
modulesDir: ['../../node_modules']
|
|
1467
|
-
}
|
|
869
|
+
```ts
|
|
870
|
+
export default defineNuxtConfig({
|
|
871
|
+
modulesDir: ['../../node_modules'],
|
|
872
|
+
})
|
|
1468
873
|
```
|
|
1469
874
|
|
|
1470
875
|
## nitro
|
|
@@ -1600,8 +1005,17 @@ Tree shake code from specific builds.
|
|
|
1600
1005
|
Tree shake composables from the server or client builds.
|
|
1601
1006
|
|
|
1602
1007
|
**Example**:
|
|
1603
|
-
```
|
|
1604
|
-
|
|
1008
|
+
```ts
|
|
1009
|
+
export default defineNuxtConfig({
|
|
1010
|
+
optimization: {
|
|
1011
|
+
treeShake: {
|
|
1012
|
+
composables: {
|
|
1013
|
+
client: { vue: ['onMounted'] },
|
|
1014
|
+
server: { vue: ['onServerPrefetch'] },
|
|
1015
|
+
},
|
|
1016
|
+
},
|
|
1017
|
+
},
|
|
1018
|
+
})
|
|
1605
1019
|
```
|
|
1606
1020
|
|
|
1607
1021
|
##### `client`
|
|
@@ -1655,10 +1069,12 @@ Whether to use the vue-router integration in Nuxt 3. If you do not provide a val
|
|
|
1655
1069
|
Additionally, you can provide a glob pattern or an array of patterns to scan only certain files for pages.
|
|
1656
1070
|
|
|
1657
1071
|
**Example**:
|
|
1658
|
-
```
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1072
|
+
```ts
|
|
1073
|
+
export default defineNuxtConfig({
|
|
1074
|
+
pages: {
|
|
1075
|
+
pattern: ['**/*/*.vue', '!**/*.spec.*'],
|
|
1076
|
+
},
|
|
1077
|
+
})
|
|
1662
1078
|
```
|
|
1663
1079
|
|
|
1664
1080
|
## plugins
|
|
@@ -1679,15 +1095,17 @@ need to customize their order. All plugins are deduplicated by their src path.
|
|
|
1679
1095
|
**See**: [`app/plugins/` directory documentation](https://nuxt.com/docs/4.x/guide/directory-structure/plugins)
|
|
1680
1096
|
|
|
1681
1097
|
**Example**:
|
|
1682
|
-
```
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1098
|
+
```ts
|
|
1099
|
+
export default defineNuxtConfig({
|
|
1100
|
+
plugins: [
|
|
1101
|
+
'~/custom-plugins/foo.client.js', // only in client side
|
|
1102
|
+
'~/custom-plugins/bar.server.js', // only in server side
|
|
1103
|
+
'~/custom-plugins/baz.js', // both client & server
|
|
1104
|
+
{ src: '~/custom-plugins/both-sides.js' },
|
|
1105
|
+
{ src: '~/custom-plugins/client-only.js', mode: 'client' }, // only on client side
|
|
1106
|
+
{ src: '~/custom-plugins/server-only.js', mode: 'server' }, // only on server side
|
|
1107
|
+
],
|
|
1108
|
+
})
|
|
1691
1109
|
```
|
|
1692
1110
|
|
|
1693
1111
|
## postcss
|
|
@@ -1789,15 +1207,15 @@ Values are automatically replaced by matching env variables at runtime, e.g. set
|
|
|
1789
1207
|
```
|
|
1790
1208
|
|
|
1791
1209
|
**Example**:
|
|
1792
|
-
```
|
|
1793
|
-
export default {
|
|
1794
|
-
|
|
1210
|
+
```ts
|
|
1211
|
+
export default defineNuxtConfig({
|
|
1212
|
+
runtimeConfig: {
|
|
1795
1213
|
apiKey: '', // Default to an empty string, automatically set at runtime using process.env.NUXT_API_KEY
|
|
1796
1214
|
public: {
|
|
1797
|
-
|
|
1798
|
-
}
|
|
1799
|
-
}
|
|
1800
|
-
}
|
|
1215
|
+
baseURL: '', // Exposed to the frontend as well.
|
|
1216
|
+
},
|
|
1217
|
+
},
|
|
1218
|
+
})
|
|
1801
1219
|
```
|
|
1802
1220
|
|
|
1803
1221
|
## serverDir
|
|
@@ -1825,10 +1243,12 @@ Each handler accepts the following options:
|
|
|
1825
1243
|
::
|
|
1826
1244
|
|
|
1827
1245
|
**Example**:
|
|
1828
|
-
```
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1246
|
+
```ts
|
|
1247
|
+
export default defineNuxtConfig({
|
|
1248
|
+
serverHandlers: [
|
|
1249
|
+
{ route: '/path/foo/**:name', handler: '~/server/foohandler.ts' },
|
|
1250
|
+
],
|
|
1251
|
+
})
|
|
1832
1252
|
```
|
|
1833
1253
|
|
|
1834
1254
|
## sourcemap
|
|
@@ -1911,10 +1331,10 @@ If a relative path is specified, it will be relative to the `rootDir`.
|
|
|
1911
1331
|
- **Default:** `"app"` (Nuxt 4), `"."` (Nuxt 3 with `compatibilityMode: 3`)
|
|
1912
1332
|
|
|
1913
1333
|
**Example**:
|
|
1914
|
-
```
|
|
1915
|
-
export default {
|
|
1916
|
-
srcDir: 'app/'
|
|
1917
|
-
}
|
|
1334
|
+
```ts
|
|
1335
|
+
export default defineNuxtConfig({
|
|
1336
|
+
srcDir: 'app/',
|
|
1337
|
+
})
|
|
1918
1338
|
```
|
|
1919
1339
|
This expects the following folder structure:
|
|
1920
1340
|
```bash
|
|
@@ -2062,8 +1482,9 @@ Enable the legacy compatibility mode for `unhead` module. This applies the follo
|
|
|
2062
1482
|
**Example**:
|
|
2063
1483
|
```ts
|
|
2064
1484
|
export default defineNuxtConfig({
|
|
2065
|
-
|
|
2066
|
-
|
|
1485
|
+
unhead: {
|
|
1486
|
+
legacy: true,
|
|
1487
|
+
},
|
|
2067
1488
|
})
|
|
2068
1489
|
```
|
|
2069
1490
|
|
|
@@ -2082,10 +1503,11 @@ An object that will be passed to `renderSSRHead` to customize the output.
|
|
|
2082
1503
|
**Example**:
|
|
2083
1504
|
```ts
|
|
2084
1505
|
export default defineNuxtConfig({
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
1506
|
+
unhead: {
|
|
1507
|
+
renderSSRHeadOptions: {
|
|
1508
|
+
omitLineBreaks: true,
|
|
1509
|
+
},
|
|
1510
|
+
},
|
|
2089
1511
|
})
|
|
2090
1512
|
```
|
|
2091
1513
|
|
|
@@ -2423,7 +1845,7 @@ Hard-replaces `typeof process`, `typeof window` and `typeof document` to tree-sh
|
|
|
2423
1845
|
|
|
2424
1846
|
### `analyze`
|
|
2425
1847
|
|
|
2426
|
-
Nuxt uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them.
|
|
1848
|
+
If you are using webpack, Nuxt uses `webpack-bundle-analyzer` to visualize your bundles and how to optimize them.
|
|
2427
1849
|
|
|
2428
1850
|
Set to `true` to enable bundle analysis, or pass an object with options: [for webpack](https://github.com/webpack-contrib/webpack-bundle-analyzer#options-for-plugin) or [for vite](https://github.com/btd/rollup-plugin-visualizer#options).
|
|
2429
1851
|
|
|
@@ -2438,10 +1860,14 @@ Set to `true` to enable bundle analysis, or pass an object with options: [for we
|
|
|
2438
1860
|
```
|
|
2439
1861
|
|
|
2440
1862
|
**Example**:
|
|
2441
|
-
```
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
1863
|
+
```ts
|
|
1864
|
+
export default defineNuxtConfig({
|
|
1865
|
+
webpack: {
|
|
1866
|
+
analyze: {
|
|
1867
|
+
analyzerMode: 'static',
|
|
1868
|
+
},
|
|
1869
|
+
},
|
|
1870
|
+
})
|
|
2445
1871
|
```
|
|
2446
1872
|
|
|
2447
1873
|
### `cssSourceMap`
|
|
@@ -2474,16 +1900,16 @@ Using [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extr
|
|
|
2474
1900
|
- **Default:** `true`
|
|
2475
1901
|
|
|
2476
1902
|
**Example**:
|
|
2477
|
-
```
|
|
2478
|
-
export default {
|
|
1903
|
+
```ts
|
|
1904
|
+
export default defineNuxtConfig({
|
|
2479
1905
|
webpack: {
|
|
2480
1906
|
extractCSS: true,
|
|
2481
1907
|
// or
|
|
2482
1908
|
extractCSS: {
|
|
2483
|
-
ignoreOrder: true
|
|
2484
|
-
}
|
|
2485
|
-
}
|
|
2486
|
-
}
|
|
1909
|
+
ignoreOrder: true,
|
|
1910
|
+
},
|
|
1911
|
+
},
|
|
1912
|
+
})
|
|
2487
1913
|
```
|
|
2488
1914
|
|
|
2489
1915
|
If you want to extract all your CSS to a single file, there is a workaround for this.
|
|
@@ -2493,8 +1919,8 @@ can also improve page performance by downloading and resolving only those resour
|
|
|
2493
1919
|
that are needed.
|
|
2494
1920
|
|
|
2495
1921
|
**Example**:
|
|
2496
|
-
```
|
|
2497
|
-
export default {
|
|
1922
|
+
```ts
|
|
1923
|
+
export default defineNuxtConfig({
|
|
2498
1924
|
webpack: {
|
|
2499
1925
|
extractCSS: true,
|
|
2500
1926
|
optimization: {
|
|
@@ -2504,13 +1930,13 @@ export default {
|
|
|
2504
1930
|
name: 'styles',
|
|
2505
1931
|
test: /\.(css|vue)$/,
|
|
2506
1932
|
chunks: 'all',
|
|
2507
|
-
enforce: true
|
|
2508
|
-
}
|
|
2509
|
-
}
|
|
2510
|
-
}
|
|
2511
|
-
}
|
|
2512
|
-
}
|
|
2513
|
-
}
|
|
1933
|
+
enforce: true,
|
|
1934
|
+
},
|
|
1935
|
+
},
|
|
1936
|
+
},
|
|
1937
|
+
},
|
|
1938
|
+
},
|
|
1939
|
+
})
|
|
2514
1940
|
```
|
|
2515
1941
|
|
|
2516
1942
|
### `filenames`
|
|
@@ -2527,10 +1953,14 @@ as most browsers will cache the asset and not detect the changes on first load.
|
|
|
2527
1953
|
This example changes fancy chunk names to numerical ids:
|
|
2528
1954
|
|
|
2529
1955
|
**Example**:
|
|
2530
|
-
```
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
1956
|
+
```ts
|
|
1957
|
+
export default defineNuxtConfig({
|
|
1958
|
+
webpack: {
|
|
1959
|
+
filenames: {
|
|
1960
|
+
chunk: ({ isDev }) => (isDev ? '[name].js' : '[id].[contenthash].js'),
|
|
1961
|
+
},
|
|
1962
|
+
},
|
|
1963
|
+
})
|
|
2534
1964
|
```
|
|
2535
1965
|
|
|
2536
1966
|
#### `app`
|
|
@@ -2639,8 +2069,8 @@ See [css-loader](https://github.com/webpack-contrib/css-loader) for available op
|
|
|
2639
2069
|
**See**: [`file-loader` Options](https://github.com/webpack-contrib/file-loader#options)
|
|
2640
2070
|
|
|
2641
2071
|
**Default**:
|
|
2642
|
-
```
|
|
2643
|
-
{ esModule: false }
|
|
2072
|
+
```json
|
|
2073
|
+
{ "esModule": false }
|
|
2644
2074
|
```
|
|
2645
2075
|
|
|
2646
2076
|
##### `esModule`
|
|
@@ -2658,8 +2088,8 @@ See [css-loader](https://github.com/webpack-contrib/css-loader) for available op
|
|
|
2658
2088
|
**See**: [`file-loader` Options](https://github.com/webpack-contrib/file-loader#options)
|
|
2659
2089
|
|
|
2660
2090
|
**Default**:
|
|
2661
|
-
```
|
|
2662
|
-
{ esModule: false }
|
|
2091
|
+
```json
|
|
2092
|
+
{ "esModule": false }
|
|
2663
2093
|
```
|
|
2664
2094
|
|
|
2665
2095
|
##### `esModule`
|
|
@@ -2677,8 +2107,8 @@ See [css-loader](https://github.com/webpack-contrib/css-loader) for available op
|
|
|
2677
2107
|
**See**: [`file-loader` Options](https://github.com/webpack-contrib/file-loader#options)
|
|
2678
2108
|
|
|
2679
2109
|
**Default**:
|
|
2680
|
-
```
|
|
2681
|
-
{ esModule: false }
|
|
2110
|
+
```json
|
|
2111
|
+
{ "esModule": false }
|
|
2682
2112
|
```
|
|
2683
2113
|
|
|
2684
2114
|
##### `esModule`
|
|
@@ -2711,10 +2141,10 @@ See [css-loader](https://github.com/webpack-contrib/css-loader) for available op
|
|
|
2711
2141
|
**See**: [`sass-loader` Options](https://github.com/webpack-contrib/sass-loader#options)
|
|
2712
2142
|
|
|
2713
2143
|
**Default**:
|
|
2714
|
-
```
|
|
2144
|
+
```json
|
|
2715
2145
|
{
|
|
2716
|
-
sassOptions: {
|
|
2717
|
-
indentedSyntax: true
|
|
2146
|
+
"sassOptions": {
|
|
2147
|
+
"indentedSyntax": true
|
|
2718
2148
|
}
|
|
2719
2149
|
}
|
|
2720
2150
|
```
|
|
@@ -2849,15 +2279,20 @@ Add webpack plugins.
|
|
|
2849
2279
|
- **Type**: `array`
|
|
2850
2280
|
|
|
2851
2281
|
**Example**:
|
|
2852
|
-
```
|
|
2282
|
+
```ts
|
|
2853
2283
|
import webpack from 'webpack'
|
|
2854
2284
|
import { version } from './package.json'
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2285
|
+
|
|
2286
|
+
export default defineNuxtConfig({
|
|
2287
|
+
webpack: {
|
|
2288
|
+
plugins: [
|
|
2289
|
+
// ...
|
|
2290
|
+
new webpack.DefinePlugin({
|
|
2291
|
+
'process.VERSION': version,
|
|
2292
|
+
}),
|
|
2293
|
+
],
|
|
2294
|
+
},
|
|
2295
|
+
})
|
|
2861
2296
|
```
|
|
2862
2297
|
|
|
2863
2298
|
### `postcss`
|