diff --git a/docs/2.guide/2.directory-structure/2.nuxtrc.md b/docs/2.guide/2.directory-structure/2.nuxtrc.md new file mode 100644 index 0000000000..17e2e31b43 --- /dev/null +++ b/docs/2.guide/2.directory-structure/2.nuxtrc.md @@ -0,0 +1,50 @@ +--- +title: ".nuxtrc" +description: "The .nuxtrc file allows you to define nuxt configurations in a flat syntax." +head.title: ".nuxtrc" +navigation.icon: i-ph-file +--- + +The `.nuxtrc` file can be used to configure Nuxt with a flat syntax. It is based on [`unjs/rc9`](https://github.com/unjs/rc9). + +::tip +For more advanced configurations, use [`nuxt.config`](/docs/guide/directory-structure/nuxt-config). +:: + +## Usage + +```bash [.nuxtrc] +# Disable SSR +ssr=false + +# Configuration for `@nuxt/devtools` +devtools.enabled=true + +# Add Nuxt modules +modules[]=@nuxt/image +modules[]=nuxt-security +``` + +If present, the properties in the `nuxt.config` file will overwrite the properties in `.nuxtrc` file. + +::read-more{to="/docs/api/configuration/nuxt-config"} +Discover all the available options in the **Nuxt configuration** documentation. +:: + +## Global `.nuxtrc` File + +You can also create a global `.nuxtrc` file in your home directory to apply configurations globally. + +- On macOS/Linux, this file is located at: + + ```md + ~/.nuxtrc + ``` + +- On Windows, it is located at: + + ```md + C:\Users\{username}\.nuxtrc + ``` + +This global `.nuxtrc` file allows you to define default settings that apply to all Nuxt projects on your system. However, project-level `.nuxtrc` files will override these global settings, and `nuxt.config` will take precedence over both. diff --git a/docs/2.guide/2.directory-structure/3.nuxt-config.md b/docs/2.guide/2.directory-structure/3.nuxt-config.md index 997f8999bc..68fe9c5ec9 100644 --- a/docs/2.guide/2.directory-structure/3.nuxt-config.md +++ b/docs/2.guide/2.directory-structure/3.nuxt-config.md @@ -31,12 +31,4 @@ export default defineNuxtConfig({ Discover all the available options in the **Nuxt configuration** documentation. :: -To ensure your configuration is up to date, Nuxt will make a full restart when detecting changes in the main configuration file, the [`.env`](/docs/guide/directory-structure/env), [`.nuxtignore`](/docs/guide/directory-structure/nuxtignore) and `.nuxtrc` dotfiles. - -The `.nuxtrc` file can be used to configure Nuxt with a flat syntax. It is based on [`unjs/rc9`](https://github.com/unjs/rc9). - -``` [.nuxtrc] -ssr=false -``` - -If present the properties in `.nuxtrc` file will overwrite the properties in the `nuxt.config` file. +To ensure your configuration is up to date, Nuxt will make a full restart when detecting changes in the main configuration file, the [`.env`](/docs/guide/directory-structure/env), [`.nuxtignore`](/docs/guide/directory-structure/nuxtignore) and [`.nuxtrc`](/docs/guide/directory-structure/nuxtrc) dotfiles.