Configure Ziggy with Inertia and Svelte (SSR) #705
Replies: 2 comments
-
I'll dig into this when I have some time, I've never used Inertia SSR and it's been years since I've used Svelte so not sure how much I'm going to be able to help. Only thing I can think of looking at your code is that your |
Beta Was this translation helpful? Give feedback.
-
See #735 - I think the issue here is actually that in SSR mode you have to manually make Ziggy's config available to your app with the current URL, by overriding the route function or |
Beta Was this translation helpful? Give feedback.
-
Hello everyone,
I want to configure Inertia SSR with Ziggy and Svelte.
In normal mode (not SSR) everything works fine, and I can see the correct link in the navbar.
In SSR mode however, after running
php artisan inertia:start-ssr
, I get this error:TypeError: Cannot read properties of undefined (reading 'home') at new Router (/bootstrap/ssr/ssr.js:246:31)
. I think the problem is that in SSR-mode the app has no idea where to find all the routes. The problem is that I have no idea on how to fix it. (In SSR-mode, the link can still be seen in the navbar, but that's when Svelte hydrates on the page.)I hope anyone can help me out. Thanks in advance!
ssr.ts
Navbar.svelte
vite.config.js
Beta Was this translation helpful? Give feedback.
All reactions