diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 5a0dd20b..c4efc14f 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Cache; use Illuminate\Support\ServiceProvider; use Laravel\Pulse\Facades\Pulse; +use Illuminate\Support\Facades\Vite; use DB; class AppServiceProvider extends ServiceProvider @@ -57,6 +58,11 @@ public function boot() Queue::after(function (JobProcessed $event) { Cache::set('queue_last_processed', now()); }); + + // Vite Prefetch + if (config('inertia.vite_prefetch')) { + Vite::prefetch(concurrency: 3); + } } private function configureCommands() diff --git a/config/inertia.php b/config/inertia.php index 719af00d..bf287eca 100644 --- a/config/inertia.php +++ b/config/inertia.php @@ -59,4 +59,15 @@ ], + + /* + |-------------------------------------------------------------------------- + | Vite Prefetch + |-------------------------------------------------------------------------- + | + | This option configures if Vite should prefetch assets for Inertia pages. + | + */ + 'vite_prefetch' => env('VITE_PREFETCH', false), + ];