mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 07:32:01 +00:00
docs(migration): update to use new runtimeConfig
(#4642)
Co-authored-by: Damian <48835293+DamianGlowala@users.noreply.github.com>
This commit is contained in:
parent
cc37547993
commit
ee0b90bf36
@ -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
|
||||
}
|
||||
},
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user