From 3a2bd57f23e3ef1b24dd84c2055f24495499a144 Mon Sep 17 00:00:00 2001 From: Meghdad Date: Fri, 15 May 2026 17:42:05 +0330 Subject: [PATCH] Fixed the build warnings. --- resources/js/components/video-player.tsx | 2 +- resources/js/types/hls-light.d.ts | 8 +++++ vite.config.ts | 38 ++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 resources/js/types/hls-light.d.ts diff --git a/resources/js/components/video-player.tsx b/resources/js/components/video-player.tsx index c8b6d5d..3bb1e0d 100644 --- a/resources/js/components/video-player.tsx +++ b/resources/js/components/video-player.tsx @@ -1,4 +1,4 @@ -import Hls from 'hls.js'; +import Hls from 'hls.js/light'; import { useEffect, useRef } from 'react'; export function VideoPlayer({ diff --git a/resources/js/types/hls-light.d.ts b/resources/js/types/hls-light.d.ts new file mode 100644 index 0000000..28ab50f --- /dev/null +++ b/resources/js/types/hls-light.d.ts @@ -0,0 +1,8 @@ +// this well reduces hls-vendor from +500KB to +300KB n builds + +declare module 'hls.js/light' { + import Hls from 'hls.js'; + + export * from 'hls.js'; + export default Hls; +} diff --git a/vite.config.ts b/vite.config.ts index b855732..2091a72 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -7,6 +7,44 @@ import { bunny } from 'laravel-vite-plugin/fonts'; import { defineConfig } from 'vite'; export default defineConfig({ + build: { + rolldownOptions: { + checks: { + pluginTimings: false, + }, + output: { + codeSplitting: { + groups: [ + { + name: 'react-vendor', + test: /node_modules[\\/](react|react-dom)[\\/]/, + priority: 40, + }, + { + name: 'inertia-vendor', + test: /node_modules[\\/]@inertiajs[\\/]/, + priority: 35, + }, + { + name: 'radix-vendor', + test: /node_modules[\\/]@radix-ui[\\/]/, + priority: 30, + }, + { + name: 'hls-vendor', + test: /node_modules[\\/]hls\.js[\\/]/, + priority: 30, + }, + { + name: 'ui-vendor', + test: /node_modules[\\/](lucide-react|sonner|class-variance-authority|clsx|tailwind-merge)[\\/]/, + priority: 20, + }, + ], + }, + }, + }, + }, plugins: [ laravel({ input: ['resources/css/app.css', 'resources/js/app.tsx'],