From c50ea1623dd96887e6c2c6fd9cea5a3740835a47 Mon Sep 17 00:00:00 2001 From: Josh Deltener Date: Thu, 22 Sep 2022 20:25:16 -0500 Subject: [PATCH 1/7] docs: updated nuxt bridge migration guide added a section about the public runtime config change in Nuxt 3 --- docs/content/bridge/1.overview.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/content/bridge/1.overview.md b/docs/content/bridge/1.overview.md index 62853bd533b..7a53256fa81 100644 --- a/docs/content/bridge/1.overview.md +++ b/docs/content/bridge/1.overview.md @@ -149,6 +149,21 @@ Overwriting options such as `"compilerOptions.paths"` with your own configuratio In case you need to extend options provided by `./.nuxt/tsconfig.json` further, you can use the `alias` property withing your `nuxt.config`. `nuxi` will pick them up and extend `./.nuxt/tsconfig.json` accordingly. :: +## Update Public Runtime Config References +Nuxt 3 approaches runtime configs differently than Nuxt 2. Now, all public runtime config properties are behind a property called `public`. If you use public runtime configs, you'll need to update your code. + +``` +// nuxt.config.js +publicRuntimeConfig: { + foo: 'bar' +} +``` +``` diff +// MyWidget.vue +-
Foo: {{ $config.foo }}
++
Foo: {{ $config.public.foo }}
+``` + ## Migrate Composition API If you were using `@vue/composition-api` or `@nuxtjs/composition-api`, please read the [composition api migration guide](/bridge/bridge-composition-api). From cfbe3115acd4d75c6c87466536a4de3136362a8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 23 Sep 2022 09:48:49 +0200 Subject: [PATCH 2/7] Update docs/content/bridge/1.overview.md --- docs/content/bridge/1.overview.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/content/bridge/1.overview.md b/docs/content/bridge/1.overview.md index 7a53256fa81..f77402b7ed2 100644 --- a/docs/content/bridge/1.overview.md +++ b/docs/content/bridge/1.overview.md @@ -150,6 +150,7 @@ In case you need to extend options provided by `./.nuxt/tsconfig.json` further, :: ## Update Public Runtime Config References + Nuxt 3 approaches runtime configs differently than Nuxt 2. Now, all public runtime config properties are behind a property called `public`. If you use public runtime configs, you'll need to update your code. ``` From 434bae9935a209ef589228f658efcdadb6d0888f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 23 Sep 2022 09:49:52 +0200 Subject: [PATCH 3/7] Update docs/content/bridge/1.overview.md --- docs/content/bridge/1.overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/bridge/1.overview.md b/docs/content/bridge/1.overview.md index f77402b7ed2..656837c3704 100644 --- a/docs/content/bridge/1.overview.md +++ b/docs/content/bridge/1.overview.md @@ -153,7 +153,7 @@ In case you need to extend options provided by `./.nuxt/tsconfig.json` further, Nuxt 3 approaches runtime configs differently than Nuxt 2. Now, all public runtime config properties are behind a property called `public`. If you use public runtime configs, you'll need to update your code. -``` +```js // nuxt.config.js publicRuntimeConfig: { foo: 'bar' From 7f5798d217037fce4a87367321f3435cf82deead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 23 Sep 2022 09:49:57 +0200 Subject: [PATCH 4/7] Update docs/content/bridge/1.overview.md --- docs/content/bridge/1.overview.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/content/bridge/1.overview.md b/docs/content/bridge/1.overview.md index 656837c3704..74a4254b13f 100644 --- a/docs/content/bridge/1.overview.md +++ b/docs/content/bridge/1.overview.md @@ -159,7 +159,8 @@ publicRuntimeConfig: { foo: 'bar' } ``` -``` diff + +```diff // MyWidget.vue -
Foo: {{ $config.foo }}
+
Foo: {{ $config.public.foo }}
From 119e761a16a8b8bde03baba3f657b7b622cb60b6 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 23 Sep 2022 09:34:34 +0100 Subject: [PATCH 5/7] docs: use new `runtimeConfig` property --- docs/content/bridge/1.overview.md | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/docs/content/bridge/1.overview.md b/docs/content/bridge/1.overview.md index 74a4254b13f..572fd00a1d2 100644 --- a/docs/content/bridge/1.overview.md +++ b/docs/content/bridge/1.overview.md @@ -149,17 +149,30 @@ Overwriting options such as `"compilerOptions.paths"` with your own configuratio In case you need to extend options provided by `./.nuxt/tsconfig.json` further, you can use the `alias` property withing your `nuxt.config`. `nuxi` will pick them up and extend `./.nuxt/tsconfig.json` accordingly. :: -## Update Public Runtime Config References +## Update Runtime Config -Nuxt 3 approaches runtime configs differently than Nuxt 2. Now, all public runtime config properties are behind a property called `public`. If you use public runtime configs, you'll need to update your code. +Nuxt 3 approaches runtime configs differently than Nuxt 2, using a new combined `runtimeConfig` option. -```js +First, you'll need to combine your `publicRuntimeConfig` and `privateRuntimeConfig` properties into a new one called `runtimeConfig`, with the public config within a key called `public`. + +```diff // nuxt.config.js -publicRuntimeConfig: { - foo: 'bar' -} +- privateRuntimeConfig: { +- apiKey: process.env.NUXT_API_KEY || 'super-secret-key' +- }, +- publicRuntimeConfig: { +- websiteURL: 'https://public-data.com' +- } ++ runtimeConfig: { ++ apiKey: process.env.NUXT_API_KEY || 'super-secret-key', ++ public: { ++ websiteURL: 'https://public-data.com' ++ } ++ } ``` +This also means that when you need to access public runtime config, it's behind a property called `public`. If you use public runtime configs, you'll need to update your code. + ```diff // MyWidget.vue -
Foo: {{ $config.foo }}
From c7e6bea7ee91e5658b2d38d800b36626b53c7558 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 23 Sep 2022 09:35:21 +0100 Subject: [PATCH 6/7] docs: update example key --- docs/content/bridge/1.overview.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/bridge/1.overview.md b/docs/content/bridge/1.overview.md index 572fd00a1d2..d5b9637754f 100644 --- a/docs/content/bridge/1.overview.md +++ b/docs/content/bridge/1.overview.md @@ -175,8 +175,8 @@ This also means that when you need to access public runtime config, it's behind ```diff // MyWidget.vue --
Foo: {{ $config.foo }}
-+
Foo: {{ $config.public.foo }}
+-
Website: {{ $config.websiteURL }}
++
Website: {{ $config.public.websiteURL }}
``` ## Migrate Composition API From 427a9657b9571eedaf776637d3ae1afc8843dec6 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 23 Sep 2022 09:35:58 +0100 Subject: [PATCH 7/7] docs: singular --- docs/content/bridge/1.overview.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/bridge/1.overview.md b/docs/content/bridge/1.overview.md index d5b9637754f..aec21984ba3 100644 --- a/docs/content/bridge/1.overview.md +++ b/docs/content/bridge/1.overview.md @@ -151,7 +151,7 @@ In case you need to extend options provided by `./.nuxt/tsconfig.json` further, ## Update Runtime Config -Nuxt 3 approaches runtime configs differently than Nuxt 2, using a new combined `runtimeConfig` option. +Nuxt 3 approaches runtime config differently than Nuxt 2, using a new combined `runtimeConfig` option. First, you'll need to combine your `publicRuntimeConfig` and `privateRuntimeConfig` properties into a new one called `runtimeConfig`, with the public config within a key called `public`. @@ -171,7 +171,7 @@ First, you'll need to combine your `publicRuntimeConfig` and `privateRuntimeConf + } ``` -This also means that when you need to access public runtime config, it's behind a property called `public`. If you use public runtime configs, you'll need to update your code. +This also means that when you need to access public runtime config, it's behind a property called `public`. If you use public runtime config, you'll need to update your code. ```diff // MyWidget.vue