docs: update custom environment example

This commit is contained in:
Daniel Roe 2024-11-08 21:46:48 +00:00
parent 4491c42232
commit c32969327f
No known key found for this signature in database
GPG Key ID: CBC814C393D93268

View File

@ -33,7 +33,6 @@ You don't have to use TypeScript to build an application with Nuxt. However, it
You can configure fully typed, per-environment overrides in your nuxt.config You can configure fully typed, per-environment overrides in your nuxt.config
```ts twoslash [nuxt.config.ts] ```ts twoslash [nuxt.config.ts]
// @errors: 2353
export default defineNuxtConfig({ export default defineNuxtConfig({
$production: { $production: {
routeRules: { routeRules: {
@ -43,13 +42,15 @@ export default defineNuxtConfig({
$development: { $development: {
// //
}, },
$myCustomName: { $env: {
// staging: {
//
}
}, },
}) })
``` ```
To select an environment when running a Nuxt CLI command, simply pass the name to the `--envName` flag, like so: `nuxi build --envName myCustomName`. To select an environment when running a Nuxt CLI command, simply pass the name to the `--envName` flag, like so: `nuxi build --envName staging`.
To learn more about the mechanism behind these overrides, please refer to the `c12` documentation on [environment-specific configuration](https://github.com/unjs/c12?tab=readme-ov-file#environment-specific-configuration). To learn more about the mechanism behind these overrides, please refer to the `c12` documentation on [environment-specific configuration](https://github.com/unjs/c12?tab=readme-ov-file#environment-specific-configuration).