From 7f314d2d75e4682a4c9c14e2b400364f49b015c2 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 8 Feb 2025 00:20:55 +0200 Subject: [PATCH] feat(build): set up webpack cache --- .gitignore | 1 + src/routes/assets.ts | 8 +++++++- src/services/in_app_help.ts | 1 - 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index bbfb24483..bc1575665 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.cache .DS_Store node_modules/ dist/ diff --git a/src/routes/assets.ts b/src/routes/assets.ts index e76f0fc88..96916f85d 100644 --- a/src/routes/assets.ts +++ b/src/routes/assets.ts @@ -2,7 +2,7 @@ import assetPath from "../services/asset_path.js"; import path from "path"; import { fileURLToPath } from "url"; import express from "express"; -import { isDev } from "../services/utils.js"; +import { isDev, isElectron } from "../services/utils.js"; import type serveStatic from "serve-static"; const persistentCacheStatic = (root: string, options?: serveStatic.ServeStaticOptions>>) => { @@ -24,6 +24,12 @@ async function register(app: express.Application) { const frontendCompiler = webpack({ mode: "development", + cache: { + type: "filesystem", + cacheDirectory: isElectron + ? path.join(srcRoot, "..", "..", ".cache", "electron") + : path.join(srcRoot, "..", ".cache", "server") + }, entry: productionConfig.entry, module: productionConfig.module, resolve: productionConfig.resolve, diff --git a/src/services/in_app_help.ts b/src/services/in_app_help.ts index c06d15bd8..0af911684 100644 --- a/src/services/in_app_help.ts +++ b/src/services/in_app_help.ts @@ -28,7 +28,6 @@ function parseNoteMetaFile(noteMetaFile: NoteMetaFile): HiddenSubtreeItem[] { const metaRoot = noteMetaFile.files[0]; const parsedMetaRoot = parseNoteMeta(metaRoot, "/" + (metaRoot.dirFileName ?? "")); - console.log(JSON.stringify(parsedMetaRoot, null, 4)); return parsedMetaRoot.children ?? []; }