41 lines
950 B
JavaScript
41 lines
950 B
JavaScript
import './bootstrap'
|
|
import React from 'react'
|
|
import { createRoot } from 'react-dom/client'
|
|
import { createInertiaApp } from '@inertiajs/react'
|
|
const pages = {
|
|
...import.meta.glob([
|
|
'./Pages/Help/**/*.jsx',
|
|
'!./Pages/Help/**/__tests__/**',
|
|
'!./Pages/Help/**/*.test.jsx',
|
|
]),
|
|
...import.meta.glob([
|
|
'./Pages/Collection/**/*.jsx',
|
|
'!./Pages/Collection/**/__tests__/**',
|
|
'!./Pages/Collection/**/*.test.jsx',
|
|
]),
|
|
...import.meta.glob([
|
|
'./Pages/Group/**/*.jsx',
|
|
'!./Pages/Group/**/__tests__/**',
|
|
'!./Pages/Group/**/*.test.jsx',
|
|
]),
|
|
}
|
|
|
|
function resolvePage(name) {
|
|
const path = `./Pages/${name}.jsx`
|
|
const page = pages[path]
|
|
|
|
if (!page) {
|
|
throw new Error(`Unknown collections page: ${path}`)
|
|
}
|
|
|
|
return page().then((module) => module.default)
|
|
}
|
|
|
|
createInertiaApp({
|
|
resolve: resolvePage,
|
|
setup({ el, App, props }) {
|
|
const root = createRoot(el)
|
|
root.render(<App {...props} />)
|
|
},
|
|
})
|