diff --git a/src/client/src/plugins/core/panels.ts b/src/client/src/plugins/core/panels.ts
index f173aae..3328f40 100644
--- a/src/client/src/plugins/core/panels.ts
+++ b/src/client/src/plugins/core/panels.ts
@@ -1,8 +1,6 @@
import { html, type TemplateResult } from "lit";
import type { FileTreeEntry, GitDiffResponse, GitStatusResponse } from "../../api";
import type { WorkspacePanelContribution, WorkspacePanelContext } from "../types";
-import "../../components/CodeViewer";
-import "../../components/TerminalPanel";
export function createCoreWorkspacePanels(): WorkspacePanelContribution[] {
return [
@@ -68,6 +66,7 @@ function renderFileViewer(context: WorkspacePanelContext): TemplateResult {
if (context.selectedFilePath === undefined || context.selectedFilePath === "") return html`
Select a file.
`;
if (file === undefined) return html`Loading ${context.selectedFilePath}…
`;
if (file.binary) return html`Binary file: ${file.path}
`;
+ loadCodeViewer();
return html`
@@ -75,6 +74,7 @@ function renderFileViewer(context: WorkspacePanelContext): TemplateResult {
}
function renderTerminal(context: WorkspacePanelContext): TemplateResult {
+ loadTerminalPanel();
return html``;
}
@@ -120,6 +120,7 @@ function renderDiffViewer(context: WorkspacePanelContext): TemplateResult {
}
function renderDiffSection(diff: GitDiffResponse): TemplateResult {
+ loadCodeViewer();
return html`
@@ -128,6 +129,14 @@ function renderDiffSection(diff: GitDiffResponse): TemplateResult {
`;
}
+function loadCodeViewer(): void {
+ void import("../../components/CodeViewer");
+}
+
+function loadTerminalPanel(): void {
+ void import("../../components/TerminalPanel");
+}
+
function gitSummary(status: GitStatusResponse): string {
const branch = status.branch ?? "detached";
const ahead = status.ahead ?? 0;
diff --git a/vite.config.ts b/vite.config.ts
index 31b2c01..3320d22 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -5,6 +5,18 @@ export default defineConfig({
build: {
outDir: "../../dist/client",
emptyOutDir: true,
+ rollupOptions: {
+ output: {
+ manualChunks(id) {
+ if (!id.includes("node_modules")) return;
+ if (id.includes("@codemirror/legacy-modes")) return "vendor-editor-legacy";
+ if (id.includes("@lezer/common") || id.includes("@lezer/highlight") || id.includes("@lezer/lr")) return "vendor-editor-core";
+ if (id.includes("@codemirror/lang-") || id.includes("@lezer/")) return "vendor-editor-languages";
+ if (id.includes("@codemirror") || id.includes("codemirror")) return "vendor-editor-core";
+ if (id.includes("@xterm")) return "vendor-terminal";
+ },
+ },
+ },
},
server: {
port: 5173,