[6.x] Bundle Control Panel icons into a single chunk - #15112
Merged
Conversation
`import.meta.glob` emitted one lazy chunk per icon, so every distinct icon rendered on a page cost its own request. A cold-cache Control Panel page load fired 30-40 of them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request fixes an issue where the Control Panel makes far more HTTP requests than it needs to, which can trip Cloudflare rate limiting rules — like the ones enabled by default on Laravel Cloud.
This was happening because the icon registry loads icons with
import.meta.glob, which emits one lazily-loaded chunk per icon. SinceIcon.vueawaits a separate loader for each one, every distinct icon rendered on a page was its own request. The nav alone accounts for around 20 of them, on every page.It wasn't a problem in v5 because the nav was rendered in Blade with its icons inlined server-side, and much less of the Control Panel was Vue.
This PR fixes it by grouping the icons into a single chunk. The chunk is still lazily loaded, so the icons stay out of the entry bundle, but they arrive in one request and are cached from then on.
The build now emits 143 assets instead of 690. Measured against a sandbox site with a cold cache:
Helps with #14711