Skip to content

Build your personal knowledge base with Trilium Notes

fix(client): highlightjs not working properly in dev mode

Elian Doran7e1eaafc2520
diff --git a/apps/client/vite.config.ts b/apps/client/vite.config.ts
index ffdddbc6c7..bfb12af0eb 100644
--- a/apps/client/vite.config.ts
+++ b/apps/client/vite.config.ts
@@ -1,5 +1,5 @@
/// <reference types='vitest' />
-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() ],