docs(migration): update to use new runtimeConfig (#4642)

Co-authored-by: Damian <48835293+DamianGlowala@users.noreply.github.com>
This commit is contained in:
Tobias Diez 2022-04-27 11:05:08 +02:00 committed by GitHub
parent cc37547993
commit ee0b90bf36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,7 +13,7 @@ When referencing these variables within your components, you will have to use th
## Migration
1. Add any environment variables you use in your app to your `publicRuntimeConfig` or `privateRuntimeConfig`.
1. Add any environment variables that you use in your app to the `runtimeConfig` property of the `nuxt.config` file.
1. Migrate `process.env` to `useRuntimeConfig` throughout the Vue part of your app.
## Example
@ -25,9 +25,9 @@ import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({
runtimeConfig: {
secretKey: '', // variables that can only be accessed on server-side
secretKey: '', // variable that can only be accessed on the server side
public: {
BASE_URL: process.env.BASE_URL || 'https://nuxtjs.org'
BASE_URL: process.env.BASE_URL || 'https://nuxtjs.org' // variable that can also be accessed on the client side
}
},
})