Skip to content

Commit

Permalink
Eagerly prefetch assets
Browse files Browse the repository at this point in the history
  • Loading branch information
timacdonald committed Aug 26, 2024
1 parent de07bd9 commit dc62270
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,11 @@ 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.' Vite::prefetch(concurrency: 3);'.PHP_EOL,
], '', $provider);
ServiceProvider::addProviderToBootstrapFile('App\Providers\JetstreamServiceProvider');

// Models...
Expand Down Expand Up @@ -766,8 +770,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
*/
Expand Down
3 changes: 3 additions & 0 deletions stubs/app/Providers/JetstreamServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -24,6 +25,8 @@ public function boot(): void
$this->configurePermissions();

Jetstream::deleteUsersUsing(DeleteUser::class);

Vite::prefetch(concurrency: 3);
}

/**
Expand Down

0 comments on commit dc62270

Please sign in to comment.