feat: Use Vite for client code splitting
Replaced Bun's client bundler with Vite to fix code splitting issues. Extracted React and Excalidraw into their own manual chunks to prevent the monolithic 7MB index.js from blocking rendering. FCP decreased significantly since browsers can now cache these chunks independently.
This commit is contained in:
+3
-2
@@ -5,7 +5,7 @@
|
||||
"scripts": {
|
||||
"dev": "bun --hot src/dev-server.tsx",
|
||||
"build": "rm -rf dist && bun run build:client && bun run build:server",
|
||||
"build:client": "bun build --target=browser --production --outdir ./dist/public ./src/index.html",
|
||||
"build:client": "vite build",
|
||||
"build:server": "mkdir -p ./dist/server && bun build --target=bun --production --outfile ./dist/server/server.js ./src/server.tsx",
|
||||
"start": "DATABASE_PATH=./data/excalidraw.sqlite bun ./dist/server/server.js",
|
||||
"test": "bun test",
|
||||
@@ -20,6 +20,7 @@
|
||||
"@types/bun": "^1.3.14",
|
||||
"@types/react": "^19.2.15",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"typescript": "^5.9.3"
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "^5.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user