Skip to content

[6.x] Lazy load Inertia page components#14582

Merged
jasonvarga merged 2 commits into6.xfrom
statamic-js-changes
Apr 30, 2026
Merged

[6.x] Lazy load Inertia page components#14582
jasonvarga merged 2 commits into6.xfrom
statamic-js-changes

Conversation

@jasonvarga
Copy link
Copy Markdown
Member

@jasonvarga jasonvarga commented Apr 30, 2026

Summary

Switches the Inertia page resolver from eager to lazy import.meta.glob, so each CP page is split into its own chunk and fetched on demand.

The previous version eagerly imported every .vue file under resources/js/pages/ into the main bundle. Now import.meta.glob returns a map of dynamic imports, and the resolver awaits the matching one.

This is one part extracted from #14512

Impact

The initial index-*.js bundle drops from ~230 KB to ~94 KB on a fresh load. Per-page navigation cost is unchanged in practice — the chunk fetch overlaps with Inertia's existing data request.

Test plan

  • Production build splits pages into per-page chunks
  • Navigation between pages works on Slow 3G with no broken UI (only the expected loading bar)
  • Offline navigation behavior matches the previous branch (request fails, no regression)
  • Addon page resolution (inertia.get(name)) still works
  • NonInertiaPage Blade fallback still renders

jasonvarga and others added 2 commits April 30, 2026 14:39
Co-authored-by: Waldemar Pankratz <waldemar.pankratz@voll.digital>
@jasonvarga jasonvarga merged commit 19a5b8e into 6.x Apr 30, 2026
17 checks passed
@jasonvarga jasonvarga deleted the statamic-js-changes branch April 30, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant