Skip to content

Commit

Permalink
[11.x] Add Vite auto refresh to error page (#51635)
Browse files Browse the repository at this point in the history
* Add Vite auto refresh to error page

This adds Vite hot reloading to the error page

* Update Renderer.php
  • Loading branch information
riasvdv authored May 30, 2024
1 parent b2e9ffc commit 8306c69
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Illuminate/Foundation/Exceptions/Renderer/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,16 @@ public static function css()
*/
public static function js()
{
$viteJsAutoRefresh = '';

$vite = app(\Illuminate\Foundation\Vite::class);

if (is_file($vite->hotFile())) {
$viteJsAutoRefresh = $vite->__invoke([]);
}

return '<script type="text/javascript">'
.file_get_contents(static::DIST.'scripts.js')
.'</script>';
.'</script>'.$viteJsAutoRefresh;
}
}

0 comments on commit 8306c69

Please sign in to comment.