Sha256: 89e8642933aa11e2d6e7d3b110a4f5fe35e22ddd2326597ebccb25f6a70b9fca

Contents?: true

Size: 980 Bytes

Versions: 8

Compression:

Stored size: 980 Bytes

Contents

import './bootstrap'
import '../../assets/builds/tailwind.css'

import { createApp, h, DefineComponent } from 'vue'
import { createInertiaApp } from '@inertiajs/vue3'

async function resolvePageComponent<T>(
  path: string | string[],
  pages: Record<string, Promise<T> | (() => Promise<T>)>,
): Promise<T> {
  for (const p of Array.isArray(path) ? path : [path]) {
    const page = pages[p]

    if (typeof page === 'undefined') {
      continue
    }

    return typeof page === 'function' ? page() : page
  }

  throw new Error(`Page not found: ${path}`)
}

const appName = import.meta.env.VITE_APP_NAME || 'Rails'

createInertiaApp({
  title: (title) => `${title} - ${appName}`,
  resolve: (name) =>
    resolvePageComponent(`../Pages/${name}.vue`, import.meta.glob<DefineComponent>('../Pages/**/*.vue')),
  setup({ el, App, props, plugin }) {
    createApp({ render: () => h(App, props) })
      .use(plugin)
      .mount(el)
  },
  progress: {
    color: '#4B5563',
  },
})

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
kaze-0.17.0 stubs/inertia-vue-ts/app/javascript/entrypoints/application.ts
kaze-0.16.0 stubs/inertia-vue-ts/app/javascript/entrypoints/application.ts
kaze-0.15.0 stubs/inertia-vue-ts/app/javascript/entrypoints/application.ts
kaze-0.14.0 stubs/inertia-vue-ts/app/javascript/entrypoints/application.ts
kaze-0.13.0 stubs/inertia-vue-ts/app/javascript/entrypoints/application.ts
kaze-0.12.0 stubs/inertia-vue-ts/app/javascript/entrypoints/application.ts
kaze-0.11.0 stubs/inertia-vue-ts/app/javascript/entrypoints/application.ts
kaze-0.10.0 stubs/inertia-vue-ts/app/javascript/entrypoints/application.ts