Open TiiFuchs opened 1 month ago
I found a workaround by doing this in every component I need routes:
import {route as ziggyRoute} from "ziggy-js";
const route = inject<typeof ziggyRoute>("route")!;
Hi, I have this problem too. I use Inertia Laravel + Inertia/Svelte. Here's the issue I create in my repository: https://github.com/senkulabs/breeze-lite/issues/4. I don't setup any route in my Svelte components. I just use @route
blade directive that I put in app.blade.php
. That's it. I was thinking that this is more than enough. But, it turns out no.
+1, same issue, but with Jetstream.
I will try the workaround, but I think it's a bug. Probably will be fixed with Inertia 2.0? Hopefully!
+1, same issue, but with Jetstream.
I will try the workaround, but I think it's a bug. Probably will be fixed with Inertia 2.0? Hopefully!
I run into this myself with Jetstream as well, but only intermittently.
Hi, I have this problem too. I use Inertia Laravel + Inertia/Svelte. Here's the issue I create in my repository: senkulabs/breeze-lite#4. I don't setup any route in my Svelte components. I just use
@route
blade directive that I put inapp.blade.php
. That's it. I was thinking that this is more than enough. But, it turns out no.
It turns out that I need to explicitly tell the vite the exact location of Ziggy's route in ssr.js
or ssr.ts
in order to solve this problem.
- import { route } from 'ziggy-js';
+ import { route } from '../../vendor/tightenco/ziggy';
I'm not quite sure where to put this.
I just verified that its not just my app.
I installed a fresh Laravel project with Laravel Breeze using Vue with Inertia, Inertia SSR and TypeScript.
Then I added a
console.log(route('profile'))
in my Welcome.vue files<script setup>
section. compiled everything withnpm run build
, started the ssr server withphp artisan inertia:start-ssr
, disabled JavaScript in my browser and reload the page.The result is always the same:
It's always
ReferenceError: route is not defined
.That's the problem I have in my application too. With JavaScript running from the browser: No problems at all. Everything works fine. But without JavaScript, so it definitely comes from the SSR server:
route is not defined
.I'm a litte overwhelmed with this... Someone any ideas?