Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(client): use different root mechanism with fewer issues
Elian Doran37381b7c36ca
diff --git a/apps/client/src/index.html b/apps/client/index.htmlsimilarity index 95%rename from apps/client/src/index.htmlrename to apps/client/index.htmlindex b1541e784b..e1db353327 100644--- a/apps/client/src/index.html+++ b/apps/client/index.html@@ -19,7 +19,7 @@<!-- This works even when the user directly changes --root-background in CSS --><div id="background-color-tracker" style="position: absolute; visibility: hidden; color: var(--root-background); transition: color 1ms;"></div>- <script src="./index.ts" type="module"></script>+ <script src="./src/index.ts" type="module"></script><!-- Required for correct loading of scripts in Electron --><script>diff --git a/apps/client/vite.config.mts b/apps/client/vite.config.mtsindex bd9b18289e..62d8330403 100644--- a/apps/client/vite.config.mts+++ b/apps/client/vite.config.mts@@ -19,7 +19,7 @@ if (isDev) {plugins = [viteStaticCopy({targets: assets.map((asset) => ({- src: `${asset}/*`,+ src: `src/${asset}/*`,dest: asset}))}),@@ -27,7 +27,7 @@ if (isDev) {structured: true,targets: [{- src: "../../../node_modules/@excalidraw/excalidraw/dist/prod/fonts/*",+ src: "../../node_modules/@excalidraw/excalidraw/dist/prod/fonts/*",dest: "",}]@@ -37,8 +37,8 @@ if (isDev) {}export default defineConfig(() => ({- root: join(__dirname, "src"),- cacheDir: join(__dirname, "../../.cache/vite"),+ root: __dirname,+ cacheDir: '../../.cache/vite',base: "",plugins,// Use esbuild for JSX transformation (much faster than Babel)@@ -79,14 +79,14 @@ export default defineConfig(() => ({},build: {target: "esnext",- outDir: '../dist',+ outDir: './dist',emptyOutDir: true,reportCompressedSize: true,sourcemap: false,rollupOptions: {input: {- index: join(__dirname, "src", "index.html"),- login: join(__dirname, "src", "login.ts"),+ index: join(__dirname, "index.html"),+ login: join(__dirname, "src", "login.ts"),setup: join(__dirname, "src", "setup.ts"),set_password: join(__dirname, "src", "set_password.ts"),runtime: join(__dirname, "src", "runtime.ts"),diff --git a/apps/server/src/routes/assets.ts b/apps/server/src/routes/assets.tsindex ecd57da8b7..c68b64bc18 100644--- a/apps/server/src/routes/assets.ts+++ b/apps/server/src/routes/assets.ts@@ -50,8 +50,8 @@ async function register(app: express.Application) {req.url = `/${assetUrlFragment}/index.html`;vite.middlewares(req, res, next);});- app.get(`/index.ts`, [ rootLimiter ], (req, res, next) => {- req.url = `/${assetUrlFragment}/index.ts`;+ app.get(`/src/index.ts`, [ rootLimiter ], (req, res, next) => {+ req.url = `/${assetUrlFragment}/src/index.ts`;vite.middlewares(req, res, next);});app.use(`/node_modules/@excalidraw/excalidraw/dist/prod`, persistentCacheStatic(path.join(srcRoot, "../../node_modules/@excalidraw/excalidraw/dist/prod")));