feat(build): set up webpack cache

This commit is contained in:
Elian Doran 2025-02-08 00:20:55 +02:00
parent 61b7d887cc
commit 7f314d2d75
No known key found for this signature in database
3 changed files with 8 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.cache
.DS_Store
node_modules/
dist/

View File

@ -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<express.Response<any, Record<string, any>>>) => {
@ -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,

View File

@ -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 ?? [];
}