nuxt icon indicating copy to clipboard operation
nuxt copied to clipboard

Styling of Regular Component Lost in Production When Nested Inside Global Server Component

Open vsergiu93 opened this issue 1 year ago • 4 comments

Environment

  • Operating System: Linux
  • Node Version: v20.9.0
  • Nuxt Version: 3.9.3
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: [email protected]
  • Builder: -
  • User Config: devtools, experimental, modules, srcDir
  • Runtime Modules: @nuxtjs/[email protected]
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-rkhot3?file=README.md

Describe the bug

Component Setup:

  • Component A: This is a global server component (A.server.global.vue)
  • Component B: A regular component with specific scoped styling. (B.vue)

Behavior Observed:

  • In development mode (nuxt dev), everything works as expected. component B's styling is correctly applied when it is used inside component A.
  • In production mode (npm run build && node .output/server/index.mjs), the styling of component B is not applied when it is used inside component A.

I provided a stackblitz reproduction link, but that starts directly in dev mode, and as I said above everything works in dev mode, the stackblitz needs to be started in production mode.

Additional context

No response

Logs

No response

vsergiu93 avatar Jan 19 '24 18:01 vsergiu93

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

stackblitz[bot] avatar Jan 19 '24 18:01 stackblitz[bot]

Hi :wave: is it reproductible with a non global server component ? If so, this may be a duplicate of https://github.com/nuxt/nuxt/issues/24480

huang-julien avatar Jan 20 '24 19:01 huang-julien

Hi @huang-julien, thanks for checking, you are right, it is reproductible with a non global server component, but please note that for me this only happens in production build not in dev mode.

vsergiu93 avatar Jan 20 '24 20:01 vsergiu93

I may not have an in-depth understanding of every aspect, but I will make an effort to respond to all requests for additional information.

Does my test repository replicate the same issue presented here, or should I create a new issue for it?

Repo: https://github.com/imnaK/nuxt-minimal-starter

Bug in short: My style ref will not be applied on a scroll listener on production/preview server. It will work as expected if I switch pages or on dev server.

imnaK avatar Jan 20 '24 21:01 imnaK

resolved in https://github.com/nuxt/nuxt/pull/25455

danielroe avatar Jan 28 '24 21:01 danielroe