build: migrate manualChunks to function form for Vite 8 / Rolldown

Vite 8 switches the bundler to Rolldown, which no longer accepts the
object form of rollupOptions.output.manualChunks — it must be a function.
Convert it (same ndk/vendor split intent) and give tsconfig.node.json a
modern target/lib so vite.config.ts type-checks against String.includes.
This commit is contained in:
Jure
2026-06-15 21:15:11 +02:00
parent 4a4843d3fc
commit 23ef37da11
3 changed files with 10 additions and 3 deletions
+3
View File
@@ -48,3 +48,6 @@ skills-lock.json
*.njsproj
*.sln
*.sw?
# TypeScript incremental build info
*.tsbuildinfo
+2
View File
@@ -2,6 +2,8 @@
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"target": "ES2022",
"lib": ["ES2023"],
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
+5 -3
View File
@@ -18,12 +18,14 @@ export default defineConfig(async () => ({
build: {
rollupOptions: {
output: {
manualChunks: {
// Vite 8 / Rolldown requires manualChunks as a function (the object
// form is no longer accepted). Same intent as before:
manualChunks(id: string) {
// NDK is the largest dependency (~300kB) — split it out so the
// main bundle parses faster at startup and the chunk can be cached.
"ndk": ["@nostr-dev-kit/ndk"],
if (id.includes("node_modules/@nostr-dev-kit/ndk")) return "ndk";
// React runtime — stable across releases, cache-friendly.
"vendor": ["react", "react-dom"],
if (id.includes("node_modules/react-dom/") || id.includes("node_modules/react/")) return "vendor";
},
},
},