Basic Laravel project
Some checks failed
linter / quality (push) Successful in 3m37s
tests / ci (push) Failing after 8m4s

This commit is contained in:
2025-08-15 17:55:11 +02:00
commit 0eaf20efa7
249 changed files with 26846 additions and 0 deletions

31
resources/js/ssr.ts Normal file
View File

@@ -0,0 +1,31 @@
import { createInertiaApp } from '@inertiajs/vue3';
import createServer from '@inertiajs/vue3/server';
import { renderToString } from 'vue/server-renderer';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import { createSSRApp, DefineComponent, h } from 'vue';
import { ZiggyVue } from 'ziggy-js';
const appName = import.meta.env.VITE_APP_NAME || 'Laravel';
createServer((page) =>
createInertiaApp({
page,
render: renderToString,
title: (title) => title ? `${title} - ${appName}` : appName,
resolve: resolvePage,
setup: ({ App, props, plugin }) =>
createSSRApp({ render: () => h(App, props) })
.use(plugin)
.use(ZiggyVue, {
...page.props.ziggy,
location: new URL(page.props.ziggy.location),
}),
}),
{ cluster: true },
);
function resolvePage(name: string) {
const pages = import.meta.glob<DefineComponent>('./pages/**/*.vue');
return resolvePageComponent<DefineComponent>(`./pages/${name}.vue`, pages);
}