Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Oleksandr Kobyletskyi's avatar

Oleksandr Kobyletskyi liked a comment+100 XP

3mos ago

Build Modern Laravel Apps Using Inertia.js: Ep 14, Code Splitting and Dynamic Imports

Vite has removed automatic vendor chunking.

You can still use this feature by applying the following to your vite.config.js file :

import { defineConfig, splitVendorChunkPlugin } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';

export default defineConfig({
  plugins: [
      laravel({ ... }),
      vue({ ... }),
      splitVendorChunkPlugin(),
  ],
});
Oleksandr Kobyletskyi's avatar

Oleksandr Kobyletskyi liked a comment+100 XP

3mos ago

Build Modern Laravel Apps Using Inertia.js: Ep 14, Code Splitting and Dynamic Imports

If you're using Vite, here's a full working app.js file with code-splitting and dynamic imports turned on or off based on the enableCodeSplitting flag that I have defined. I hope this helps!