azbx liked a comment+100 XP
5mos ago
azbx liked a comment+100 XP
5mos ago
@yoeriboven If you don’t like the controller namespace binding, just import the named route function instead.
azbx liked a comment+100 XP
5mos ago
I usually eat whatever Laravel releases but can’t get into this. The binding between controller namespace and frontend import doesn’t work for me. I don’t want to do a backend refactor and then have to figure out where I use that controller in the frontend.
Might not be an issue in reality but I think I’d regret using this.
Ziggy is great but it is not so great in that it exports all routes to the frontend. Would be nice if Ziggy could resolve the routes during the build process.
azbx liked a comment+100 XP
5mos ago
I am using Laravel 11, Vue3 and Inertiajs along with Typescript. I am trying to setup SSR
My ssr.ts is as follows
import { createInertiaApp } from '@inertiajs/vue3';
import createServer from '@inertiajs/vue3/server';
import { renderToString } from '@vue/server-renderer';
import { createSSRApp, DefineComponent, h } from 'vue';
import { ZiggyVue } from 'ziggy-js';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
createServer(page =>
createInertiaApp({
page,
render: renderToString,
resolve: (name) =>
resolvePageComponent(
`./Pages/${name}.vue`,
import.meta.glob<DefineComponent>('./Pages/**/*.vue'),
),
setup({ App, props, plugin }) {
return createSSRApp({
render: () => h(App, props)
}).use(plugin).use(ZiggyVue);
}
})
);
I followed the instructions etc and I run
npm run build
Which runs ok, then I try
Starting SSR server on port 13714...
Inertia SSR server started
And that runs ok, but when I refresh the site, I get the error
TypeError: Cannot read properties of undefined (reading 'welcome')
Which looks like its on the route...I have been looking around for ages and cannot seem to fix it.