Skip to content

Commit 1eaf0dd

Browse files
feat: integrate monaco-editor locally
1 parent 98e050a commit 1eaf0dd

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"dependencies": {
3131
"@hookform/resolvers": "^5.0.1",
3232
"@monaco-editor/react": "^4.7.0",
33+
"monaco-editor": "^0.47.0",
3334
"@radix-ui/react-accordion": "^1.2.11",
3435
"@radix-ui/react-alert-dialog": "^1.1.14",
3536
"@radix-ui/react-aspect-ratio": "^1.1.7",
@@ -106,7 +107,8 @@
106107
"postcss": "^8.5.4",
107108
"tailwindcss": "^4.1.8",
108109
"typescript": "~5.8.3",
109-
"vite": "^6.3.5"
110+
"vite": "^6.3.5",
111+
"vite-plugin-static-copy": "^1.0.1"
110112
},
111113
"trustedDependencies": [
112114
"@sentry/cli",

src/main.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as Sentry from "@sentry/react";
2+
import { loader } from '@monaco-editor/react';
23
import React from "react";
34
import ReactDOM from "react-dom/client";
45
import "./i18n";
@@ -7,6 +8,13 @@ import "./index.css";
78

89
import App from "./App";
910

11+
// Configure the loader to use local assets from the 'public/vs' directory
12+
loader.config({
13+
paths: {
14+
vs: '/vs'
15+
}
16+
});
17+
1018
try {
1119
Sentry.init({
1220
dsn: "https://cffe540e38313f6e71bcca722906b654@o4508483919609856.ingest.us.sentry.io/4508854105210880",

vite.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { sentryVitePlugin } from "@sentry/vite-plugin";
22
import react from "@vitejs/plugin-react";
33
import path from "path";
44
import { defineConfig } from "vite";
5+
import { viteStaticCopy } from 'vite-plugin-static-copy';
56

67
const host = process.env.TAURI_DEV_HOST;
78

@@ -17,6 +18,14 @@ export default defineConfig(async () => ({
1718
org: "bestcodes-official",
1819
project: "codequill-react",
1920
}),
21+
viteStaticCopy({
22+
targets: [
23+
{
24+
src: path.resolve(__dirname, 'node_modules/monaco-editor/min/vs'),
25+
dest: '.', // Copies 'vs' folder to the root of the 'public' directory
26+
},
27+
],
28+
}),
2029
],
2130

2231
resolve: {

0 commit comments

Comments
 (0)