mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
0223f4cd61
- Remove unused setIsGoosehintsModalOpen parameter in AppLayout - Add eslint-disable comments for insights and error in SessionsInsights - Remove unused TabsList and TabsTrigger imports in SettingsView
1.9 KiB
1.9 KiB
✅ Monaco Editor - Final Fix
The Problem
The vite-plugin-monaco-editor package has ESM compatibility issues with Vite 7 and Electron Forge.
The Solution
Instead of using the plugin, we configure Monaco Editor to load directly from the bundled monaco-editor package.
Changes Made
1. Vite Renderer Config (vite.renderer.config.mts)
export default defineConfig({
plugins: [tailwindcss()],
build: {
target: 'esnext',
rollupOptions: {
output: {
// Manually chunk Monaco Editor
manualChunks: {
'monaco-editor': ['monaco-editor'],
'monaco-react': ['@monaco-editor/react'],
},
},
},
},
optimizeDeps: {
include: ['monaco-editor', '@monaco-editor/react'],
esbuildOptions: {
target: 'es2020',
},
},
worker: {
format: 'es',
},
});
2. MonacoCodeInput Component
import * as monacoEditor from 'monaco-editor';
import { loader } from '@monaco-editor/react';
// Configure Monaco loader to use the bundled version
loader.config({ monaco: monacoEditor });
How It Works
- Direct Import: We import
monaco-editordirectly in the component - Loader Configuration: We tell
@monaco-editor/reactto use our imported Monaco instance - Vite Bundling: Vite bundles Monaco and its workers using the
worker.format: 'es'config - Electron Compatible: This approach works in Electron because everything is bundled locally
Try It Now
The app should start successfully now:
npm run start-gui
Then test Monaco:
- Type
#pythonin the chat input - Monaco should load and work perfectly!
Why This Works Better
- ✅ No plugin compatibility issues
- ✅ Works with Vite 7 and Electron Forge
- ✅ All Monaco features available
- ✅ Proper worker loading
- ✅ Fast and reliable
Monaco Editor is now properly configured! 🚀