perf(ui): defer Monaco secondary viewers

This commit is contained in:
Pascal André
2026-03-19 22:49:17 +01:00
committed by Shantur Rathore
parent df74c06ba2
commit 51ac7f152d
10 changed files with 98 additions and 20 deletions

View File

@@ -116,7 +116,6 @@ export default defineConfig({
resolve: {
alias: {
"@": resolve(__dirname, "./src"),
"@git-diff-view/lowlight": resolve(__dirname, "./src/lib/git-diff-lowlight.ts"),
},
},
optimizeDeps: {
@@ -135,6 +134,34 @@ export default defineConfig({
main: resolve(__dirname, "./src/renderer/index.html"),
loading: resolve(__dirname, "./src/renderer/loading.html"),
},
output: {
manualChunks(id) {
const normalizedId = id.replace(/\\/g, "/")
if (normalizedId.includes("/node_modules/@git-diff-view/")) {
return "git-diff-vendor"
}
if (normalizedId.includes("/node_modules/highlight.js/") || normalizedId.includes("/node_modules/lowlight/")) {
return "highlight-vendor"
}
if (normalizedId.includes("/node_modules/fast-diff/")) {
return "fast-diff-vendor"
}
if (normalizedId.includes("/node_modules/monaco-editor/")) {
return "monaco-vendor"
}
if (
normalizedId.includes("/src/components/file-viewer/") ||
normalizedId.includes("/src/lib/monaco/")
) {
return "monaco-viewer"
}
},
},
},
},
})