Sha256: 40b135fbec882f1ce03280fd0fca174de5cf4600514e7c69206e6f046c0288fa

Contents?: true

Size: 932 Bytes

Versions: 13

Compression:

Stored size: 932 Bytes

Contents

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

import { createRoot } from 'react-dom/client'
import { createInertiaApp } from '@inertiajs/react'

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}.tsx`, import.meta.glob('../Pages/**/*.tsx')),
  setup({ el, App, props }) {
    const root = createRoot(el)

    root.render(<App {...props} />)
  },
  progress: {
    color: '#4B5563',
  },
})

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
kaze-1.0.1 stubs/inertia-react-ts/app/javascript/entrypoints/application.tsx
kaze-1.0.0 stubs/inertia-react-ts/app/javascript/entrypoints/application.tsx
kaze-0.19.0 stubs/inertia-react-ts/app/javascript/entrypoints/application.tsx
kaze-0.18.0 stubs/inertia-react-ts/app/javascript/entrypoints/application.tsx
kaze-0.17.0 stubs/inertia-react-ts/app/javascript/entrypoints/application.tsx
kaze-0.16.0 stubs/inertia-react-ts/app/javascript/entrypoints/application.tsx
kaze-0.15.0 stubs/inertia-react-ts/app/javascript/entrypoints/application.tsx
kaze-0.14.0 stubs/inertia-react-ts/app/javascript/entrypoints/application.tsx
kaze-0.13.0 stubs/inertia-react-ts/app/javascript/entrypoints/application.tsx
kaze-0.12.0 stubs/inertia-react-ts/app/javascript/entrypoints/application.tsx
kaze-0.11.0 stubs/inertia-react-ts/app/javascript/entrypoints/application.tsx
kaze-0.10.0 stubs/inertia-react-ts/app/javascript/entrypoints/application.tsx
kaze-0.9.0 stubs/inertia-react-ts/app/javascript/entrypoints/application.tsx