primevue
primevue copied to clipboard
Primevue doesn't work (crashes) vite ssr server (Laravel + Inertia.js ssr project)
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:
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.
- Run 'composer install'
- Run 'npm install'
You need 3 terminals open in the repo root
- On 1st terminal run 'php artisan serve'
- On 2nd terminal run 'npm run build'
- 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
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
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)
I can confirm, I have the exact issue with SSR + Vite in Laravel and InertiaJS.
same question.
We need more time to investigate this issue. I am setting a new milestone.
Thank you.
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