mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
feat(build): set up webpack cache
This commit is contained in:
parent
61b7d887cc
commit
7f314d2d75
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
|
.cache
|
||||||
.DS_Store
|
.DS_Store
|
||||||
node_modules/
|
node_modules/
|
||||||
dist/
|
dist/
|
||||||
|
@ -2,7 +2,7 @@ import assetPath from "../services/asset_path.js";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
import express from "express";
|
import express from "express";
|
||||||
import { isDev } from "../services/utils.js";
|
import { isDev, isElectron } from "../services/utils.js";
|
||||||
import type serveStatic from "serve-static";
|
import type serveStatic from "serve-static";
|
||||||
|
|
||||||
const persistentCacheStatic = (root: string, options?: serveStatic.ServeStaticOptions<express.Response<any, Record<string, any>>>) => {
|
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({
|
const frontendCompiler = webpack({
|
||||||
mode: "development",
|
mode: "development",
|
||||||
|
cache: {
|
||||||
|
type: "filesystem",
|
||||||
|
cacheDirectory: isElectron
|
||||||
|
? path.join(srcRoot, "..", "..", ".cache", "electron")
|
||||||
|
: path.join(srcRoot, "..", ".cache", "server")
|
||||||
|
},
|
||||||
entry: productionConfig.entry,
|
entry: productionConfig.entry,
|
||||||
module: productionConfig.module,
|
module: productionConfig.module,
|
||||||
resolve: productionConfig.resolve,
|
resolve: productionConfig.resolve,
|
||||||
|
@ -28,7 +28,6 @@ function parseNoteMetaFile(noteMetaFile: NoteMetaFile): HiddenSubtreeItem[] {
|
|||||||
|
|
||||||
const metaRoot = noteMetaFile.files[0];
|
const metaRoot = noteMetaFile.files[0];
|
||||||
const parsedMetaRoot = parseNoteMeta(metaRoot, "/" + (metaRoot.dirFileName ?? ""));
|
const parsedMetaRoot = parseNoteMeta(metaRoot, "/" + (metaRoot.dirFileName ?? ""));
|
||||||
console.log(JSON.stringify(parsedMetaRoot, null, 4));
|
|
||||||
return parsedMetaRoot.children ?? [];
|
return parsedMetaRoot.children ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user