Closed timacdonald closed 6 months ago
Thanks for submitting a PR!
Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.
Pull requests that are abandoned in draft may be closed due to inactivity.
@driesvints, if you have a release script for this you will need to update the build command to npm run build
.
@timacdonald our repos with asset compilation use the compile assets workflow. I've made the necessary adjustments but just FYI it's this: https://github.com/laravel/horizon/commit/8d31ff178bf5493efc2b2629c10612054f31f584
Thanks!
Horizon was migrated to Vite +
laravel-vite-plugin
. Thelaravel-vite-plugin
is not meant for packages. There was some additional work done to support the asset URL. We ended up having a lot of workarounds to make things work.This PR rethinks Horizon's asset story completely to try and simplify things.
Main changes
Inline assets on the dashboard
CSS, JS, and the favicon are now delivered inline. The horizon dashboard is a single-page app, so there is no real-world drawbacks here IMO.
The total transfer size is ~280kb over the wire. Yes we lose browser caching of the assets, but we also had to introduce a lot of manual work to add cache busting and 280kb is nothing.
This just works™️, assets are always up to date, we no longer have to publish assets whenever we change them, and applications that use a CDN for assets are no longer having to deliver assets via their web servers - which was an issue that has been raised.
Remove
laravel-vite-plugin
and usages of theVite
facade.As I mentioned, the
laravel-vite-plugin
is meant for Laravel apps. It doesn't really offer anything for packages and in some ways makes things harder.We just use raw Vite now when working on Horizon.
Minor changes
/public/build
to/dist
Considerations
npm run watch
and it will rebuild the assets whenever they change.