From 7e1eaafc2520f02359971a0db4032a46afacb08f Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 20 May 2025 18:06:55 +0300 Subject: [PATCH] fix(client): highlightjs not working properly in dev mode --- apps/client/vite.config.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/client/vite.config.ts b/apps/client/vite.config.ts index ffdddbc6c..bfb12af0e 100644 --- a/apps/client/vite.config.ts +++ b/apps/client/vite.config.ts @@ -1,5 +1,5 @@ /// -import { join } from 'path'; +import { join, resolve } from 'path'; import { defineConfig } from 'vite'; import { viteStaticCopy } from 'vite-plugin-static-copy' import asset_path from './src/asset_path'; @@ -35,6 +35,15 @@ export default defineConfig(() => ({ ] }) ], + resolve: { + alias: [ + // Force the use of dist in development mode because upstream ESM is broken (some hybrid between CJS and ESM, will be improved in upcoming versions). + { + find: "@triliumnext/highlightjs", + replacement: resolve(__dirname, "node_modules/@triliumnext/highlightjs/dist") + } + ] + }, // Uncomment this if you are using workers. // worker: { // plugins: [ nxViteTsPaths() ],