ozziexsh/laravel-jetstream-react

How to: SSR

Closed this issue · 3 comments

Hi, I've made a fresh install with SSR, but can't seem to run it. Do I run SSR via php artisan inertia:start-ssr or through node bootstrap/ssr/app.js? From earlier issues I saw that ssr should be found in public/js/ssr.js, but mine is in bootstrap/ssr/app.js.

When running through php artisan, I get ReferenceError: window is not defined.

What am I doing wrong?

I am not sure about this, but window might just be available in client side components not server side components like in NEXTJS

hey, yes php artisan inertia:start-ssr is the new way to use ssr

can you verify you followed these steps:

composer create-project laravel/laravel myapp
cd myapp
composer require laravel/jetstream
php artisan jetstream:install inertia --ssr
npx laravel-jetstream-react@latest install --ssr
npm run build
php artisan inertia:start-ssr

i just tried these myself and cannot reproduce the error

if the above steps do not fix it please share what file is throwing that error and a reproducible repo

Hi, thanks for the reply!

I thought I followed your steps, but it seems I might have skipped the ssr part in npx laravel-jetstream-react@latest install --ssr.

Seems like a user error yet again 🫡