Created
July 1, 2022 23:03
-
-
Save Shelob9/b11115b7cac0fabdebfbecb9c7377ec1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import './bootstrap'; | |
import '../css/app.css'; | |
import React from 'react'; | |
import { render } from 'react-dom'; | |
import { createInertiaApp } from '@inertiajs/inertia-react'; | |
import { InertiaProgress } from '@inertiajs/progress'; | |
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers'; | |
const appName = window.document.getElementsByTagName('title')[0]?.innerText || 'Laravel'; | |
createInertiaApp({ | |
title: (title) => `${title} - ${appName}`, | |
//Changed from .jsx to .tsx so pages would load | |
resolve: (name) => resolvePageComponent( | |
`./Pages/${name}.tsx`, | |
//Also here | |
import.meta.glob('./Pages/**/*.tsx') | |
), | |
setup({ el, App, props }) { | |
return render(<App {...props} />, el); | |
}, | |
}); | |
InertiaProgress.init({ color: '#4B5563' }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment