Skip to content

Commit 51cf3f0

Browse files
committed
Update monaco.ts
1 parent b6ae075 commit 51cf3f0

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/lib/monaco.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,16 @@ const GITHUB_DARK_EDITOR_COLORS: monaco.editor.IColors = {
6464

6565
export const configureMonaco = () => {
6666
// Route YAML language to monaco-yaml worker, everything else to the default editor worker
67-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
68-
(self as any).MonacoEnvironment = {
69-
getWorker: (_: string, label: string) => {
70-
if (label === 'yaml') {
71-
return new YamlWorker();
72-
}
73-
return new EditorWorker();
74-
},
75-
};
67+
if (typeof window !== 'undefined') {
68+
window.MonacoEnvironment = {
69+
getWorker: (_moduleId: string, label: string): Worker => {
70+
if (label === 'yaml') {
71+
return new YamlWorker();
72+
}
73+
return new EditorWorker();
74+
},
75+
};
76+
}
7677

7778
monaco.editor.defineTheme(GITHUB_LIGHT_DEFAULT, {
7879
base: 'vs',

0 commit comments

Comments
 (0)