Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Created July 1, 2022 23:03
Show Gist options
  • Save Shelob9/b11115b7cac0fabdebfbecb9c7377ec1 to your computer and use it in GitHub Desktop.
Save Shelob9/b11115b7cac0fabdebfbecb9c7377ec1 to your computer and use it in GitHub Desktop.
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