-
-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Environment:
- Laravel version: 11 (upgraded from v10, old directory structure)
- Livewire version: 3.5.12
- wire-elements/wire-spy version: 0.0.9
- PHP version: 8.2
The route for livewire/wire-spy.min.js defined in the SupportAutoInjectedAssets::provide() method, does not seems to register correctly, causing a 404 error when accessed. After investigating, I found that this issue could be related to the timing of when the route is registered within the application's lifecycle.
After adding logging in SupportAutoInjectedAssets::provide(), I noticed that the method is called before the application has fully registered all routes, which prevents the route from being accessible. However, modifying the route registration in provide() to use App::booted resolves the issue:
class SupportAutoInjectedAssets extends ComponentHook
{
public static function provide()
{
App::booted(function(){
Route::get('livewire/wire-spy.min.js', function () {
return response(file_get_contents(base_path('vendor/wire-elements/wire-spy/dist/wire-spy.min.js')))
->header(key: 'content-type', values: 'application/javascript');
});
});
....Metadata
Metadata
Assignees
Labels
No labels