Merge pull request #163 from naweiss/fix/offline-editor

Load monaco editor from local installation
This commit is contained in:
David Montero Crespo 2026-05-11 11:40:06 -03:00 committed by GitHub
commit 861e22572e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -20,6 +20,7 @@
"format:check": "prettier --check \"src/**/*.{ts,tsx,css}\"",
"check": "npm run lint && npm run format:check",
"preview": "vite preview",
"postinstall": "mkdir -p public/monaco && cp -r node_modules/monaco-editor/min/vs public/monaco/vs",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
@ -28,6 +29,7 @@
"dependencies": {
"@google/genai": "^0.6.0",
"@monaco-editor/react": "^4.7.0",
"monaco-editor": "0.55.1",
"@types/react-syntax-highlighter": "^15.5.13",
"@wokwi/elements": "1.9.2",
"@xterm/addon-fit": "^0.11.0",

View File

@ -1,4 +1,5 @@
import { createRoot } from 'react-dom/client';
import { loader } from '@monaco-editor/react';
import './index.css';
// Side-effect import: initialises i18next BEFORE any component renders so
// useTranslation() always resolves against a live instance. Must come
@ -18,6 +19,10 @@ import './components/velxio-components/Bmp280Element';
import './components/velxio-components/EPaperElement';
import App from './App.tsx';
// Configure monaco-editor for offline use via local static assets
const monacoVsPath = `${import.meta.env.BASE_URL}monaco/vs`;
loader.config({ paths: { vs: monacoVsPath } });
createRoot(document.getElementById('root')!).render(<App />);
// Optional pro overlay. The `@pro` import resolves to a no-op stub in the