@nuxt/docs-nightly 4.1.3-29303775.dc69e26c → 4.1.3-29310283.19fc9abb
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/02.installation.md +1 -0
- package/1.getting-started/03.configuration.md +1 -1
- package/2.guide/0.index.md +3 -3
- package/2.guide/{2.directory-structure → 1.directory-structure}/.navigation.yml +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/0.nuxt.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/0.output.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/.navigation.yml +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.assets.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.components.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.composables.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.layouts.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.middleware.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.pages.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.plugins.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.utils.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/3.app-config.md +6 -6
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/3.app.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/3.error.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.content.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.modules.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.node_modules.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.public.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.server.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.shared.md +2 -2
- package/2.guide/{2.directory-structure → 1.directory-structure}/2.env.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/2.gitignore.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/2.nuxtignore.md +2 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/2.nuxtrc.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/3.nuxt-config.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/3.package.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/3.tsconfig.md +1 -1
- package/package.json +1 -1
- /package/2.guide/{1.concepts → 2.concepts}/.navigation.yml +0 -0
- /package/2.guide/{1.concepts → 2.concepts}/1.auto-imports.md +0 -0
- /package/2.guide/{1.concepts → 2.concepts}/10.nuxt-lifecycle.md +0 -0
- /package/2.guide/{1.concepts → 2.concepts}/2.vuejs-development.md +0 -0
- /package/2.guide/{1.concepts → 2.concepts}/3.rendering.md +0 -0
- /package/2.guide/{1.concepts → 2.concepts}/4.server-engine.md +0 -0
- /package/2.guide/{1.concepts → 2.concepts}/5.modules.md +0 -0
- /package/2.guide/{1.concepts → 2.concepts}/7.esm.md +0 -0
- /package/2.guide/{1.concepts → 2.concepts}/8.typescript.md +0 -0
- /package/2.guide/{1.concepts → 2.concepts}/9.code-style.md +0 -0
|
@@ -31,6 +31,7 @@ Or follow the steps below to set up a new Nuxt project on your computer.
|
|
|
31
31
|
- **Node.js**: Make sure to use an even numbered version (18, 20, etc)
|
|
32
32
|
- **Nuxtr**: Install the community-developed [Nuxtr extension](https://marketplace.visualstudio.com/items?itemName=Nuxtr.nuxtr-vscode)
|
|
33
33
|
- **WSL**: If you are using Windows and experience slow HMR, you may want to try using [WSL (Windows Subsystem for Linux)](https://docs.microsoft.com/en-us/windows/wsl/install) which may solve some performance issues.
|
|
34
|
+
- **Windows slow DNS resolution** - instead of using `localhost:3000` for local dev server on Windows, use `127.0.0.1` for much faster loading experience on browsers.
|
|
34
35
|
::
|
|
35
36
|
::
|
|
36
37
|
|
|
@@ -104,7 +104,7 @@ The `app.config.ts` file, located in the source directory (by default `app/`), i
|
|
|
104
104
|
|
|
105
105
|
A minimal configuration file exports the `defineAppConfig` function containing an object with your configuration. The `defineAppConfig` helper is globally available without import.
|
|
106
106
|
|
|
107
|
-
```ts [app.config.ts]
|
|
107
|
+
```ts [app/app.config.ts]
|
|
108
108
|
export default defineAppConfig({
|
|
109
109
|
title: 'Hello Nuxt',
|
|
110
110
|
theme: {
|
package/2.guide/0.index.md
CHANGED
|
@@ -7,12 +7,12 @@ surround: false
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
::card-group{class="sm:grid-cols-1"}
|
|
10
|
-
::card{icon="i-lucide-medal" title="Key Concepts" to="/docs/guide/concepts"}
|
|
11
|
-
Discover the main concepts behind Nuxt, from auto-import, hybrid rendering to its TypeScript support.
|
|
12
|
-
::
|
|
13
10
|
::card{icon="i-lucide-folders" title="Directory Structure" to="/docs/guide/directory-structure"}
|
|
14
11
|
Learn about Nuxt directory structure and what benefits each directory or file offers.
|
|
15
12
|
::
|
|
13
|
+
::card{icon="i-lucide-medal" title="Key Concepts" to="/docs/guide/concepts"}
|
|
14
|
+
Discover the main concepts behind Nuxt, from auto-import, hybrid rendering to its TypeScript support.
|
|
15
|
+
::
|
|
16
16
|
::card{icon="i-lucide-star" title="Going Further" to="/docs/guide/going-further"}
|
|
17
17
|
Master Nuxt with advanced concepts like experimental features, hooks, modules, and more.
|
|
18
18
|
::
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: "assets"
|
|
3
3
|
description: "The assets/ directory is used to add all the website's assets that the build tool will process."
|
|
4
4
|
head.title: "assets/"
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-folder-type-asset
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
The directory usually contains the following types of files:
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: "components"
|
|
3
3
|
head.title: "components/"
|
|
4
4
|
description: "The components/ directory is where you put all your Vue components."
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-folder-type-component
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
Nuxt automatically imports any components in this directory (along with components that are registered by any modules you may be using).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: "layouts"
|
|
3
3
|
head.title: "layouts/"
|
|
4
4
|
description: "Nuxt provides a layouts framework to extract common UI patterns into reusable layouts."
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-folder-type-view
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
::tip{icon="i-lucide-rocket" }
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: "middleware"
|
|
3
3
|
description: "Nuxt provides middleware to run code before navigating to a particular route."
|
|
4
4
|
head.title: "middleware/"
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-folder-type-middleware
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
Nuxt provides a customizable **route middleware** framework you can use throughout your application, ideal for extracting code that you want to run before navigating to a particular route.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: "plugins"
|
|
3
3
|
description: "Nuxt has a plugins system to use Vue plugins and more at the creation of your Vue application."
|
|
4
4
|
head.title: "plugins/"
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-folder-type-plugin
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
Nuxt automatically reads the files in the `app/plugins/` directory and loads them at the creation of the Vue application.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: 'utils'
|
|
3
3
|
head.title: 'utils/'
|
|
4
4
|
description: Use the utils/ directory to auto-import your utility functions throughout your application.
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-folder-type-tools
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
The main purpose of the [`app/utils/` directory](/docs/4.x/guide/directory-structure/app/utils) is to allow a semantic distinction between your Vue composables and other auto-imported utility functions.
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
title: app.config.ts
|
|
3
3
|
head.title: 'app.config.ts'
|
|
4
4
|
description: Expose reactive configuration within your application with the App Config file.
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-file-type-light-config
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
Nuxt provides an `app.config` config file to expose reactive configuration within your application with the ability to update it at runtime within lifecycle or using a nuxt plugin and editing it with HMR (hot-module-replacement).
|
|
8
|
+
Nuxt provides an `app/app.config.ts` config file to expose reactive configuration within your application with the ability to update it at runtime within lifecycle or using a nuxt plugin and editing it with HMR (hot-module-replacement).
|
|
9
9
|
|
|
10
10
|
You can easily provide runtime app configuration using `app.config.ts` file. It can have either of `.ts`, `.js`, or `.mjs` extensions.
|
|
11
11
|
|
|
12
|
-
```ts twoslash [app.config.ts]
|
|
12
|
+
```ts twoslash [app/app.config.ts]
|
|
13
13
|
export default defineAppConfig({
|
|
14
14
|
foo: 'bar'
|
|
15
15
|
})
|
|
@@ -27,7 +27,7 @@ When configuring a custom [`srcDir`](/docs/4.x/api/nuxt-config#srcdir), make sur
|
|
|
27
27
|
|
|
28
28
|
To expose config and environment variables to the rest of your app, you will need to define configuration in `app.config` file.
|
|
29
29
|
|
|
30
|
-
```ts twoslash [app.config.ts]
|
|
30
|
+
```ts twoslash [app/app.config.ts]
|
|
31
31
|
export default defineAppConfig({
|
|
32
32
|
theme: {
|
|
33
33
|
primaryColor: '#ababab'
|
|
@@ -126,14 +126,14 @@ Here's an example of how you can use:
|
|
|
126
126
|
|
|
127
127
|
::code-group
|
|
128
128
|
|
|
129
|
-
```ts twoslash [layer/app.config.ts]
|
|
129
|
+
```ts twoslash [layer/app/app.config.ts]
|
|
130
130
|
export default defineAppConfig({
|
|
131
131
|
// Default array value
|
|
132
132
|
array: ['hello'],
|
|
133
133
|
})
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
```ts twoslash [app.config.ts]
|
|
136
|
+
```ts twoslash [app/app.config.ts]
|
|
137
137
|
export default defineAppConfig({
|
|
138
138
|
// Overwrite default array value by using a merger function
|
|
139
139
|
array: () => ['bonjour'],
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: "error.vue"
|
|
3
3
|
description: "The error.vue file is the error page in your Nuxt application."
|
|
4
4
|
head.title: "error.vue"
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-file-type-vue
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
During the lifespan of your application, some errors may appear unexpectedly at runtime. In such case, we can use the `error.vue` file to override the default error files and display the error nicely.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: 'content'
|
|
3
3
|
head.title: 'content/'
|
|
4
4
|
description: Use the content/ directory to create a file-based CMS for your application.
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-folder-type-log
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
[Nuxt Content](https://content.nuxt.com) reads the [`content/` directory](/docs/4.x/guide/directory-structure/content) in your project and parses `.md`, `.yml`, `.csv` and `.json` files to create a file-based CMS for your application.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: 'modules'
|
|
3
3
|
head.title: 'modules/'
|
|
4
4
|
description: Use the modules/ directory to automatically register local modules within your application.
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-folder-type-nuxt
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
It is a good place to place any local modules you develop while building your application.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: "node_modules"
|
|
3
3
|
description: "The package manager stores the dependencies of your project in the node_modules/ directory."
|
|
4
4
|
head.title: "node_modules/"
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-folder-type-node
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
The package manager ([`npm`](https://docs.npmjs.com/cli/commands/npm) or [`yarn`](https://yarnpkg.com) or [`pnpm`](https://pnpm.io/cli/install) or [`bun`](https://bun.sh/package-manager)) creates this directory to store the dependencies of your project.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: "public"
|
|
3
3
|
description: "The public/ directory is used to serve your website's static assets."
|
|
4
4
|
head.title: "public/"
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-folder-type-public
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
Files contained within the `public/` directory are served at the root and are not modified by the build process. This is suitable for files that have to keep their names (e.g. `robots.txt`) _or_ likely won't change (e.g. `favicon.ico`).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: server
|
|
3
3
|
head.title: 'server/'
|
|
4
4
|
description: The server/ directory is used to register API and server handlers to your application.
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-folder-type-server
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
Nuxt automatically scans files inside these directories to register API and server handlers with Hot Module Replacement (HMR) support.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: 'shared'
|
|
3
3
|
head.title: 'shared/'
|
|
4
4
|
description: 'Use the shared/ directory to share functionality between the Vue app and the Nitro server.'
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-folder-type-shared
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
The `shared/` directory allows you to share code that can be used in both the Vue app and the Nitro server.
|
|
@@ -77,7 +77,7 @@ The way `shared/utils` and `shared/types` auto-imports work and are scanned is i
|
|
|
77
77
|
-----| formatters
|
|
78
78
|
-------| upper.ts # Not auto-imported
|
|
79
79
|
---| types/
|
|
80
|
-
-----| bar.
|
|
80
|
+
-----| bar.ts # Auto-imported
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
Any other files you create in the `shared/` folder must be manually imported using the `#shared` alias (automatically configured by Nuxt):
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: ".gitignore"
|
|
3
3
|
description: "A .gitignore file specifies intentionally untracked files that git should ignore."
|
|
4
4
|
head.title: ".gitignore"
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-file-type-git
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
A `.gitignore` file specifies intentionally untracked files that git should ignore.
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
title: .nuxtignore
|
|
3
3
|
head.title: '.nuxtignore'
|
|
4
4
|
description: The .nuxtignore file lets Nuxt ignore files in your project’s root directory during the build phase.
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-file-type-nuxt
|
|
6
|
+
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
The `.nuxtignore` file tells Nuxt to ignore files in your project’s root directory ([`rootDir`](/docs/4.x/api/nuxt-config#rootdir)) during the build phase.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: ".nuxtrc"
|
|
3
3
|
description: "The .nuxtrc file allows you to define nuxt configurations in a flat syntax."
|
|
4
4
|
head.title: ".nuxtrc"
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-file-type-nuxt
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
The `.nuxtrc` file can be used to configure Nuxt with a flat syntax. It is based on [`unjs/rc9`](https://github.com/unjs/rc9).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: "nuxt.config.ts"
|
|
3
3
|
description: "Nuxt can be easily configured with a single nuxt.config file."
|
|
4
4
|
head.title: "nuxt.config.ts"
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-file-type-nuxt
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
The `nuxt.config` file extension can either be `.js`, `.ts` or `.mjs`.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: package.json
|
|
3
3
|
head.title: package.json
|
|
4
4
|
description: The package.json file contains all the dependencies and scripts for your application.
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-file-type-npm
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
The minimal `package.json` of your Nuxt application should looks like:
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: "tsconfig.json"
|
|
3
3
|
description: "Nuxt generates multiple TypeScript configuration files with sensible defaults and your aliases."
|
|
4
4
|
head.title: "tsconfig.json"
|
|
5
|
-
navigation.icon: i-
|
|
5
|
+
navigation.icon: i-vscode-icons-file-type-tsconfig
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
Nuxt [automatically generates](/docs/4.x/guide/concepts/typescript) multiple TypeScript configuration files (`.nuxt/tsconfig.app.json`, `.nuxt/tsconfig.server.json`, `.nuxt/tsconfig.node.json` and `.nuxt/tsconfig.shared.json`) with the resolved aliases you are using in your Nuxt project, as well as with other sensible defaults.
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|