laravel / horizon

Dashboard and code-driven configuration for Laravel queues.
https://laravel.com/docs/horizon
MIT License
3.83k stars 643 forks source link

[5.x] Readd vite support #1421

Closed mmachatschek closed 4 months ago

mmachatschek commented 4 months ago

Fixes #1416

This readds the vite implementation to bundle the assets with a fix to support npm run dev mode on the side of consuming laravel apps.

Previously, the horizon page was broken because the Vite blade helper and the Vite Facade helper do not take into account that prebuilt assets by "third party" (in the sense of assets loaded by packages) packages should not be treated as uncompiled assets from the same laravel app.

The workaround here is suboptimal as I think the Vite blade helpers and the Vite Facade don't take into account that packages may also use these helper methods to render tags.

taylorotwell commented 4 months ago

Hey @mmachatschek - can you explain what about this solution is "suboptimal"?

mmachatschek commented 4 months ago

@taylorotwell suboptimal in the sense of having to pass in a non existent vite hotfile name in the view to work around the vite helper not being able to detect that the vendor/horizon assets were already published, as it's been pointed out here: https://github.com/laravel/horizon/issues/1416#issuecomment-2060505259

jonathan-bird commented 3 months ago

Please note that this caused an issue: https://github.com/laravel/horizon/issues/1439

Should at least use base_path or similar rather than a root dir slash in layout.blade.php to find your non existent file.