laravel-debugbar
laravel-debugbar copied to clipboard
Update JavascriptRenderer.php
Update the preg_replace() functions for $cssRoute and $jsRoute to remove the site domain when fetching those assets.
I had issues with the following tags.
<link rel="stylesheet" type="text/css" property="stylesheet" href="//my-domain.com/_debugbar/assets/stylesheets?v=1709304073&theme=dark" data-turbolinks-eval="false" data-turbo-eval="false">
<script src="//my-domain.com/_debugbar/assets/javascript?v=1709304073" data-turbolinks-eval="false" data-turbo-eval="false"></script>
which resulted in 404 errors. Changing the preg_replace regex pattern fixed this for me.
<link rel="stylesheet" type="text/css" property="stylesheet" href="/_debugbar/assets/stylesheets?v=1709304073&theme=dark" data-turbolinks-eval="false" data-turbo-eval="false">
<script src="/_debugbar/assets/javascript?v=1709304073" data-turbolinks-eval="false" data-turbo-eval="false"></script>
Would highly appreciate some input whether this is a feasible fix or if it would break other functionality.
This could fix #1575
I'm on Laravel 10 and I've spent hours trying to get the debugbar to work on localhost with WampServer without running 'artisan serve' and finally found this series of threads so I thank you all as it pointed me in the right direction. I have a custom URL for my localhost set up and for me concatinating the 'APP_URL' environment variable into the file path in 'JavascriptRenderer.php' as follows has worked so far.
$html = "<link rel='stylesheet' type='text/css' property='stylesheet' href='" . env('APP_URL') . "{$cssRoute}' data-turbolinks-eval='false' data-turbo-eval='false'>";
$html .= "<script{$nonce} src='" . env('APP_URL') . "{$jsRoute}' data-turbolinks-eval='false' data-turbo-eval='false'>";