nuxt/nuxt

馃悶 Updating app config from server plugin isn't get carried to client app

Open

#21630 opened on Jun 19, 2023

View on GitHub
聽(4 comments)聽(5 reactions)聽(0 assignees)TypeScript聽(60,221 stars)聽(5,607 forks)batch import
good first issue馃嵃 p2-nice-to-have

Description

Environment

  • Operating System: Darwin
  • Node Version: v18.15.0
  • Nuxt Version: 3.5.2
  • Nitro Version: 2.4.1
  • Package Manager: pnpm@8.5.1
  • Builder: vite
  • User Config: app, appConfig, typescript, build, devtools, vite
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-fwi5t5

Describe the bug

Hi 馃憢馃徎

I've very special requirement and for that I have to update the appConfig (e.g. theme) from server (I choose plugin for this work) based on visited URL (I'll be serving same nuxt app to multiple subpaths for demo purposes using nginx).

When I try to set the appConfig from the server plugin it updates it but as soon we reach to the client app appConfig gt reset 馃 . For example if set theme to dark using server plugin then I dont get dark on the client side.

Additional context

More context on what I'm doing. We building admin templates and we are adding nuxt support. We display 6 demos for our template and each has different subpath based on demo number (/vuexy-vuejs-admin-template/demo-1,2,3,4,5,6). We can't run 6 instances of nuxt/node app and trying to server single nuxt app via nginx when these six URL is visited.

If you have any advice on achieving above scenario let me know, I'm still exploring.

Logs

No response

Contributor guide