primevue icon indicating copy to clipboard operation
primevue copied to clipboard

Primevue doesn't work (crashes) vite ssr server (Laravel + Inertia.js ssr project)

Open c-karaolis opened this issue 1 year ago • 6 comments

Describe the bug

Trying to use Primevue within a laravel project using inertia.js results in an import error crashing the ssr server.

My understanding is that this should not be any different than a normal vite ssr project so I assume the issue is vite ssr general.

You can create an empty laravel project using the starter kits and install primevue, the error happens immediately. I can not use the reproducer templates you provided for a laravel project but I have created a public repo with a starter project and primevue installed that you can run and see the error immediately.

The error: image

Reproducer

https://github.com/c-karaolis/primevue-inertiassr-reproduction

PrimeVue version

3.47.1

Vue version

3.x

Language

ALL

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

Go to the root folder of the repo I provided.

  1. Run 'composer install'
  2. Run 'npm install'

You need 3 terminals open in the repo root

  1. On 1st terminal run 'php artisan serve'
  2. On 2nd terminal run 'npm run build'
  3. On 3rd terminal run 'php artisan inertia:start-ssr' . This is where the error will appear

Expected behavior

Expected the vite ssr server to start and serve requests normally as it should

c-karaolis avatar Jan 29 '24 11:01 c-karaolis

Thanks a lot for the sample! I set a milestone for it. I'll check it before the milestone is released. I think this issue may be related to esm build. _esm.js vs _esm.mjs

mertsincan avatar Jan 29 '24 11:01 mertsincan

Thanks a lot for the sample! I set a milestone for it. I'll check it before the milestone is released. I think this issue may be related to esm build. _esm.js vs _esm.mjs

Thank you. Just a note I did not clearly mention, this ONLY happens with the SSR setup. Everything works normally on the SPA version (inertia without ssr)

c-karaolis avatar Jan 29 '24 12:01 c-karaolis

I can confirm, I have the exact issue with SSR + Vite in Laravel and InertiaJS.

rinoj avatar Feb 08 '24 09:02 rinoj

same question.

k99k5 avatar Feb 09 '24 02:02 k99k5

We need more time to investigate this issue. I am setting a new milestone.

Thank you.

tugcekucukoglu avatar Feb 23 '24 14:02 tugcekucukoglu

It seems like people have already found a workaround for this issue.

Please refer to this comment, it fixed my issue and now I have a functional SSR code.

https://github.com/primefaces/primevue/issues/4220#issuecomment-2001494379

rinoj avatar Mar 22 '24 00:03 rinoj