diff --git a/src/Console/InstallCommand.php b/src/Console/InstallCommand.php index 41c4cb6dc..0fce894ae 100644 --- a/src/Console/InstallCommand.php +++ b/src/Console/InstallCommand.php @@ -196,7 +196,13 @@ protected function installLivewireStack() copy(__DIR__.'/../../stubs/resources/markdown/policy.md', resource_path('markdown/policy.md')); // Service Providers... - copy(__DIR__.'/../../stubs/app/Providers/JetstreamServiceProvider.php', app_path('Providers/JetstreamServiceProvider.php')); + copy(__DIR__.'/../../stubs/app/Providers/JetstreamServiceProvider.php', $provider = app_path('Providers/JetstreamServiceProvider.php')); + + $this->replaceInFile([ + PHP_EOL.'use Illuminate\Support\Facades\Vite;', + PHP_EOL.PHP_EOL.' Vite::prefetch(concurrency: 3);', + ], '', $provider); + ServiceProvider::addProviderToBootstrapFile('App\Providers\JetstreamServiceProvider'); // Models... @@ -766,8 +772,8 @@ protected function runDatabaseMigrations() /** * Replace a given string within a given file. * - * @param string $search * @param string $replace + * @param string|array $search * @param string $path * @return void */ diff --git a/stubs/app/Providers/JetstreamServiceProvider.php b/stubs/app/Providers/JetstreamServiceProvider.php index 91398494e..2c8b5f978 100644 --- a/stubs/app/Providers/JetstreamServiceProvider.php +++ b/stubs/app/Providers/JetstreamServiceProvider.php @@ -3,6 +3,7 @@ namespace App\Providers; use App\Actions\Jetstream\DeleteUser; +use Illuminate\Support\Facades\Vite; use Illuminate\Support\ServiceProvider; use Laravel\Jetstream\Jetstream; @@ -24,6 +25,8 @@ public function boot(): void $this->configurePermissions(); Jetstream::deleteUsersUsing(DeleteUser::class); + + Vite::prefetch(concurrency: 3); } /**