By default, Inertia lazy-loads page components, splitting each page into its own bundle that is loaded on demand. This reduces the initial JavaScript bundle size but requires additional requests when visiting new pages. You may disable lazy loading to eagerly bundle all pages into a single file. Eager loading eliminates per-page requests but increases the initial bundle size.Documentation Index
Fetch the complete documentation index at: https://inertiajs.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Vite Plugin
Thelazy option in the pages shorthand controls how page components are loaded. It defaults to true.
Manual Vite
You may configure code splitting manually using Vite’simport.meta.glob() function when not using the Inertia Vite plugin. Pass { eager: true } to bundle all pages, or omit it to lazy-load them.
Webpack
To use code splitting with Webpack, you will first need to enable dynamic imports via a Babel plugin. Let’s install it now..babelrc file in your project with the following configuration:
resolve callback in your app’s initialization code to use import instead of require.