import '../css/app.css'; import { createInertiaApp } from '@inertiajs/vue3'; import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers'; import { createApp, h, type DefineComponent } from 'vue'; import * as inertia from '@inertiajs/vue3'; import * as vue from 'vue'; import { ZiggyVue } from 'ziggy-js'; import * as ui from './plugin-api'; import { installVanguardRuntime, resolvePage } from './vanguard'; const appName = document.title || 'Vanguard'; /** * Expose the shared runtime before Inertia resolves the first page so plugin * bundles that loaded ahead of us are drained and their pages are resolvable. */ installVanguardRuntime({ vue, inertia, ui }); void createInertiaApp({ title: (title) => (title ? `${title} - ${appName}` : appName), resolve: (name: string): DefineComponent | Promise => { if (name.includes('::')) { return resolvePage(name); } return resolvePageComponent( `./pages/${name}.vue`, import.meta.glob('./pages/**/*.vue'), ); }, setup({ el, App, props, plugin }) { createApp({ render: () => h(App, props) }) .use(plugin) .use(ZiggyVue) .mount(el); }, progress: { color: '#179970', }, });