diff --git a/apps/client/src/widgets/type_widgets/canvas.ts b/apps/client/src/widgets/type_widgets/canvas.ts index 369585936..962a7ff4a 100644 --- a/apps/client/src/widgets/type_widgets/canvas.ts +++ b/apps/client/src/widgets/type_widgets/canvas.ts @@ -132,7 +132,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget { // currently required by excalidraw, in order to allows self-hosting fonts locally. // this avoids making excalidraw load the fonts from an external CDN. - (window as any).EXCALIDRAW_ASSET_PATH = `${window.location.origin}/${asset_path}/app-dist/excalidraw/`; + (window as any).EXCALIDRAW_ASSET_PATH = `${new URL(import.meta.url).origin}/node_modules/@excalidraw/excalidraw/dist/prod`; // temporary vars this.currentNoteId = ""; diff --git a/apps/client/vite.config.ts b/apps/client/vite.config.ts index 83bc0a6fc..ae2762f69 100644 --- a/apps/client/vite.config.ts +++ b/apps/client/vite.config.ts @@ -22,6 +22,15 @@ export default defineConfig(() => ({ src: `src/${asset}/**/*`, dest: asset })) + }), + viteStaticCopy({ + structured: true, + targets: [ + { + src: "node_modules/@excalidraw/excalidraw/dist/prod/fonts/*", + dest: "", + } + ] }) ], // Uncomment this if you are using workers. diff --git a/apps/server/package.json b/apps/server/package.json index 5895621f6..8947ee2f8 100644 --- a/apps/server/package.json +++ b/apps/server/package.json @@ -10,7 +10,6 @@ }, "devDependencies": { "@electron/remote": "2.1.2", - "@excalidraw/excalidraw": "0.18.0", "@types/archiver": "6.0.3", "@types/better-sqlite3": "7.6.13", "@types/cls-hooked": "4.3.9", diff --git a/apps/server/src/routes/assets.ts b/apps/server/src/routes/assets.ts index eda10773b..e712b31b4 100644 --- a/apps/server/src/routes/assets.ts +++ b/apps/server/src/routes/assets.ts @@ -38,7 +38,6 @@ async function register(app: express.Application) { app.use(`/${assetPath}/translations/`, persistentCacheStatic(path.join(resourceDir, "public", "translations"))); app.use(`/${assetPath}/images`, persistentCacheStatic(path.join(resourceDir, "assets", "images"))); app.use(`/${assetPath}/app-dist/doc_notes`, persistentCacheStatic(path.join(resourceDir, "assets", "doc_notes"))); - app.use(`/${assetPath}/app-dist/excalidraw/fonts`, persistentCacheStatic(path.join(resourceDir, "node_modules/@excalidraw/excalidraw/dist/prod/fonts"))); } app.use(`/assets/vX/fonts`, express.static(path.join(srcRoot, "public/fonts"))); app.use(`/assets/vX/images`, express.static(path.join(srcRoot, "..", "images"))); @@ -48,9 +47,6 @@ async function register(app: express.Application) { const nodeModulesDir = isDev ? path.join(srcRoot, "..", "node_modules") : path.join(resourceDir, "node_modules"); - app.use(`/node_modules/@excalidraw/excalidraw/dist/fonts/`, express.static(path.join(nodeModulesDir, "@excalidraw/excalidraw/dist/prod/fonts/"))); - app.use(`/${assetPath}/node_modules/@excalidraw/excalidraw/dist/fonts/`, persistentCacheStatic(path.join(nodeModulesDir, "@excalidraw/excalidraw/dist/prod/fonts/"))); - app.use(`/${assetPath}/node_modules/jquery/dist/`, persistentCacheStatic(path.join(nodeModulesDir, "jquery/dist/"))); app.use(`/${assetPath}/node_modules/jquery-hotkeys/`, persistentCacheStatic(path.join(nodeModulesDir, "jquery-hotkeys/"))); diff --git a/apps/server/webpack.config.cjs b/apps/server/webpack.config.cjs index e2baf752e..6b9711675 100644 --- a/apps/server/webpack.config.cjs +++ b/apps/server/webpack.config.cjs @@ -13,7 +13,6 @@ function buildFilesToCopy() { }); const nodePaths = [ - "@excalidraw/excalidraw/dist/prod/fonts/", "jquery/dist", "jquery-hotkeys", "jquery.fancytree/dist", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 78b1cad4d..d1a47c03c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -500,9 +500,6 @@ importers: '@electron/remote': specifier: 2.1.2 version: 2.1.2(electron@36.2.1) - '@excalidraw/excalidraw': - specifier: 0.18.0 - version: 0.18.0(@types/react-dom@19.1.5(@types/react@19.1.4))(@types/react@19.1.4)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) '@triliumnext/commons': specifier: workspace:* version: link:../../packages/commons