Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS not Server Side Rendered with PrimeVue 4 / Nuxt 3 #5945

Closed
cheike569 opened this issue Jun 22, 2024 · 3 comments
Closed

CSS not Server Side Rendered with PrimeVue 4 / Nuxt 3 #5945

cheike569 opened this issue Jun 22, 2024 · 3 comments
Assignees
Labels
Package: Module name: @primevue/nuxt-module Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@cheike569
Copy link

cheike569 commented Jun 22, 2024

Describe the bug

I'm on PrimeVue 4.0.0-rc.2 with Nuxt 3.12.12.

Theme styles are not rendered Server Side.

Whenever I do a full page reload, the layout shifts and it takes a second before the PrimeVue component chunks are loaded (including the styles).

This was working in PrimeVue 3 without issues.

nuxt.config.js

import Aura from '@primevue/themes/aura';

/* ... */

primevue: {
        options: {
            theme: {
                preset: Aura
            },
        }
}

ssrissue

Reproducer

https://stackblitz.com/edit/nuxt-starter-xjup5v?file=app.vue

Compare the PrimeVue component to a regular button with a custom CSS class. (see style.css)
The button will be red from the very beginning, and not shift later.

shift

PrimeVue version

4.0.0-rc.2

Vue version

3.x

Language

TypeScript

Build / Runtime

Vue CLI App

Browser(s)

No response

Steps to reproduce the behavior

Setup a new Nuxt Project with PrimeVue 4.

Expected behavior

CSS should be processed on the server and delivered with the initial response. This worked in PrimeVue 3.

@cheike569 cheike569 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jun 22, 2024
@adrianpdm
Copy link

adrianpdm commented Jun 23, 2024

I also experienced this issue.
However, such issue only occur when manually importing component.

export default defineNuxtConfig({
  modules: ['@primevue/nuxt-module'],
  primevue: {
    components: {
      include: [], // set to empty array to prevent registering all components
    },
  },
})

Here's what i've tried so far:

  • manually import in Vue SFC script block
    <script lang="ts">
    import PButton from 'primevue/button'
    export default {
      components: {
        PButton,
      },
    }
    </script>
  • manually import in Vue SFC script setup block
    <script setup lang="ts">
    import PButton from 'primevue/button'
    </script>
  • register components manually via module using addComponent
    export default defineNuxtModule({
      setup() {
        addComponent({
          filePath: 'primevue/button',
          name: 'PButton',
        })
      },
    })
  • register components manually via plugin using nuxtApp.vueApp.component()
    import PButton from 'primevue/button'
    export default defineNuxtPlugin({
      setup(nuxtApp) {
        nuxtApp.vueApp.component('PButton', PButton)
      },
    })
  • use unplugin-vue-components and primevue-autoimport-resolver to register used components automatically

All exhibits same behavior, that is CSS not server-rendered

@mertsincan mertsincan self-assigned this Jun 24, 2024
@mertsincan mertsincan added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jun 24, 2024
@mertsincan mertsincan added this to the 4.0.0-rc.3 milestone Jun 24, 2024
@mertsincan mertsincan added the Package: Module name: @primevue/nuxt-module label Jun 24, 2024
@cheike569
Copy link
Author

@mertsincan This was working in 4.0.0-rc.3, and is now broken again in 4.0.2.
See: https://stackblitz.com/edit/nuxt-starter-xjup5v?file=package.json

@danielklein-arch
Copy link

Any update on this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: Module name: @primevue/nuxt-module Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

4 participants