import "./bootstrap";
import "../css/app.css";

import { createApp, h } from "vue";
import { createInertiaApp } from "@inertiajs/inertia-vue3";
import { resolvePageComponent } from "laravel-vite-plugin/inertia-helpers";

createInertiaApp({
  id: 'app',
  title: (title) => `${title}`,
  resolve: (name) =>{
    // resolvePageComponent(
    //   `./Pages/${name}.vue`,
    //   import.meta.glob("./Pages/**/*.vue")
    // ),
    const pages = import.meta.glob('./Pages/**/*.vue', { eager: false })
    return pages[`./Pages/${name}.vue`]},
  setup({ el, app, props, plugin }) {
    return createApp({ render: () => h(app, props) })
      .use(plugin)
      .mount(el);
  },
});
// createInertiaApp({
//   id: 'app',
//   resolve: name => {
//     const pages = import.meta.glob('./Pages/**/*.vue', { eager: false })
//     return pages[`./Pages/${name}.vue`]
//   },
//   setup({ el, App, props, plugin }) {
//     createApp({ render: () => h(App, props) })
//       .use(plugin)
//       .mount(el)
//   },
// })