From e81221d89d37b716d948877959c757397828ebc9 Mon Sep 17 00:00:00 2001 From: fi3ework Date: Fri, 8 Jul 2022 22:06:42 +0800 Subject: [PATCH] fix(build): cache key should consider file path --- src/node/markdownToVue.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/node/markdownToVue.ts b/src/node/markdownToVue.ts index eeb567a30dac..bc82adb5fa0d 100644 --- a/src/node/markdownToVue.ts +++ b/src/node/markdownToVue.ts @@ -43,8 +43,9 @@ export async function createMarkdownToVueRenderFn( ): Promise => { const relativePath = slash(path.relative(srcDir, file)) const dir = path.dirname(file) + const cacheKey = JSON.stringify({ src, file }) - const cached = cache.get(src) + const cached = cache.get(cacheKey) if (cached) { debug(`[cache hit] ${relativePath}`) return cached @@ -148,7 +149,7 @@ export async function createMarkdownToVueRenderFn( deadLinks, includes } - cache.set(src, result) + cache.set(cacheKey, result) return result } }