From a7419fe1ba064d8748e6b6df4dcc245118aaadc7 Mon Sep 17 00:00:00 2001 From: cfngc4594 Date: Mon, 7 Apr 2025 12:05:17 +0800 Subject: [PATCH] fix(editor/footer): delay the import of Monaco's MarkerSeverity until window is defined --- .../playground/workspace/editor/components/footer.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/features/playground/workspace/editor/components/footer.tsx b/src/components/features/playground/workspace/editor/components/footer.tsx index 6fb689e..bdc34d8 100644 --- a/src/components/features/playground/workspace/editor/components/footer.tsx +++ b/src/components/features/playground/workspace/editor/components/footer.tsx @@ -2,7 +2,6 @@ import { cn } from "@/lib/utils"; import { useEffect, useState } from "react"; -import { MarkerSeverity } from "monaco-editor"; import { useProblem } from "@/hooks/use-problem"; import { CircleXIcon, TriangleAlertIcon } from "lucide-react"; @@ -10,6 +9,13 @@ interface WorkspaceEditorFooterProps { className?: string; } +let MarkerSeverity: typeof import("monaco-editor").MarkerSeverity; +if (typeof window !== "undefined") { + import("monaco-editor").then((monaco) => { + MarkerSeverity = monaco.MarkerSeverity; + }); +} + export function WorkspaceEditorFooter({ className, ...props