Update JavascriptRenderer.php#1555
Update JavascriptRenderer.php#1555marcuschristiansen wants to merge 1 commit intofruitcake:masterfrom
Conversation
Update the preg_replace functions for $cssRoute and $jsRoute to remove the site domain when fetching those assets.
|
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'></script>"; |
|
Is this fixed then? Or still an issue?> |
|
To the best of my knowledge it's no longer an issue. I've had no need to customise any code in Laravel 11 & 12 to get the debugbar working immediately after the composer install. The original code that was causing me an issue was: $cssRoute = route('debugbar.assets.css', [ This then became the following in later versions.: $cssRoute = preg_replace('/\Ahttps?://[^\/]+/', '', route('debugbar.assets.css', [ This was also the same for the $jsRoute it should be noted. Happy New Year! |
|
We moves the rendering to php-debugbar. But not sure why any of these changes would be required otherwise. |
Update the
preg_replace()functions for$cssRouteand$jsRouteto 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_replaceregex 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.