From 96ff5f707256847a2f397ba45d3838c6e5c8ecbe Mon Sep 17 00:00:00 2001 From: dubisdev Date: Sun, 9 Jul 2023 20:37:26 +0200 Subject: [PATCH] feat: load monaco from local --- src/components/LoadPage.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/LoadPage.tsx b/src/components/LoadPage.tsx index 5277f74..7782848 100644 --- a/src/components/LoadPage.tsx +++ b/src/components/LoadPage.tsx @@ -3,9 +3,19 @@ import { LoadingDots } from "./LoadingDots" import { useHashLocation } from "../hooks/useHashLocation" import { init } from "@x-python/core"; +import * as monaco from 'monaco-editor'; +import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'; +import { loader } from "@monaco-editor/react" + const LoadPage = () => { const [_, navigate] = useHashLocation() useEffect(() => { + self.MonacoEnvironment = { + getWorker(_) { + return new editorWorker(); + }, + }; + loader.config({ monaco }) init() .then(() => navigate("/app")) }, [])