From dfebbeec5727784e1257cec2ac6386aaa480280c Mon Sep 17 00:00:00 2001 From: Jaro Camphuijsen Date: Tue, 19 Sep 2023 14:53:34 +0200 Subject: [PATCH] Fix global variable issue --- components/Banner.vue | 2 +- config.json | 4 +++- nuxt.config.ts | 7 +++++-- pages/index.vue | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/components/Banner.vue b/components/Banner.vue index dc5b6b79..5d52ab63 100644 --- a/components/Banner.vue +++ b/components/Banner.vue @@ -8,7 +8,7 @@

- {{ $config.title }} Lessons + {{ $config.public.title }} Lessons

diff --git a/config.json b/config.json index fa6fb069..fd12bc2c 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,8 @@ - { + "myConfig": + { "title": "Essentials for Research Software Support", "categoryOrder": ["Getting started", "Reusability", "Publishing & Citing", "Resources", "Examples"], "another": "foo bar baz" + } } \ No newline at end of file diff --git a/nuxt.config.ts b/nuxt.config.ts index aa4697c0..bc32c351 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,8 +1,11 @@ // https://nuxt.com/docs/api/configuration/nuxt-config -import config from './config.json' +import { myConfig } from './config.json' export default defineNuxtConfig({ - runtimeConfig: config, + runtimeConfig: { + public: myConfig, + } + , devtools: { enabled: true, pages: true }, diff --git a/pages/index.vue b/pages/index.vue index 93ecbefe..1cf69083 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -2,7 +2,7 @@
- Testing import from the config file: {{ $config.another }} + Testing import from the config file: {{ $config.public.another }}