Added lazy load, visualizer and optimized bundle chunks (#635)

* Added lazy load.

* Added visualizer and improved hljs import only yaml

* Optimized manualChunks
This commit is contained in:
yuri-sakharov
2025-12-06 17:19:35 +02:00
committed by GitHub
parent 651397e2d2
commit 077582e795
15 changed files with 437 additions and 84 deletions

View File

@@ -3,6 +3,7 @@ import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";
import { viteStaticCopy } from "vite-plugin-static-copy";
import flowbiteReact from "flowbite-react/plugin/vite";
import { visualizer } from "rollup-plugin-visualizer";
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
@@ -12,6 +13,11 @@ export default defineConfig(({ mode }) => {
react({ babel: { plugins: ["babel-plugin-react-compiler"] } }), // React and "babel-plugin-react-compiler" plugins should be first
tailwindcss(),
flowbiteReact(),
visualizer({
filename: "../pkg/frontend/dist/stats.html",
gzipSize: true,
brotliSize: true,
}),
viteStaticCopy({
targets: [
{
@@ -36,8 +42,7 @@ export default defineConfig(({ mode }) => {
rollupOptions: {
output: {
manualChunks: {
react: ["react", "react-dom", "react-router"],
vendors: ["luxon", "highlight.js", "diff2html", "swagger-ui-react"],
react: ["react", "react-dom", "react-router", "flowbite-react"],
},
},
},