import '../css/app.css'; import './bootstrap'; import { createInertiaApp } from '@inertiajs/vue3'; import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers'; import { createApp, DefineComponent, h } from 'vue'; import { ZiggyVue } from '../../vendor/tightenco/ziggy'; const appName = import.meta.env.VITE_APP_NAME || 'Laravel'; const pages = import.meta.glob('./Features/**/*.vue'); createInertiaApp({ title: (title) => `${title} - ${appName}`, resolve: (name) => { const feature = name.includes('/') ? name.split('/').slice(0, -1).join('/') : ''; const pageName = name.includes('/') ? name.split('/').pop() : name; const candidates = feature ? [ `./Features/${feature}/Pages/${pageName}.vue`, `./Features/${feature}/${pageName}.vue`, `./Features/${name}.vue`, ] : [ `./Features/Pages/${pageName}.vue`, `./Features/${pageName}.vue`, ]; const found = candidates.find((path) => pages[path]); if (!found) { throw new Error(`Page not found: ${name}`); } return resolvePageComponent(found, pages); }, setup({ el, App, props, plugin }) { createApp({ render: () => h(App, props) }) .use(plugin) .use(ZiggyVue) .mount(el); }, progress: { color: '#4B5563', }, });