From 027ad6475c1c3005d309f5946a337a840075e3ad Mon Sep 17 00:00:00 2001 From: meteorlxy Date: Fri, 17 Jan 2020 14:08:59 +0800 Subject: [PATCH 1/2] fix: add parse options to cache key --- lib/parse.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/parse.ts b/lib/parse.ts index f0c4543..0feb9fd 100644 --- a/lib/parse.ts +++ b/lib/parse.ts @@ -52,7 +52,15 @@ export function parse(options: ParseOptions): SFCDescriptor { sourceRoot = '', needMap = true } = options - const cacheKey = hash(filename + source) + const cacheKey = hash( + filename + + source + + JSON.stringify( + Object.entries(compilerParseOptions).sort(([key1], [key2]) => + key1.localeCompare(key2) + ) + ) + ) let output: SFCDescriptor = cache.get(cacheKey) if (output) return output output = compiler.parseComponent(source, compilerParseOptions) From e40d2a977e2b7b001a4fb460e8bc8f83207621f2 Mon Sep 17 00:00:00 2001 From: meteorlxy Date: Tue, 21 Jan 2020 14:00:15 +0800 Subject: [PATCH 2/2] tweaks --- lib/parse.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/parse.ts b/lib/parse.ts index 0feb9fd..5c6c6ac 100644 --- a/lib/parse.ts +++ b/lib/parse.ts @@ -53,13 +53,7 @@ export function parse(options: ParseOptions): SFCDescriptor { needMap = true } = options const cacheKey = hash( - filename + - source + - JSON.stringify( - Object.entries(compilerParseOptions).sort(([key1], [key2]) => - key1.localeCompare(key2) - ) - ) + filename + source + JSON.stringify(compilerParseOptions) ) let output: SFCDescriptor = cache.get(cacheKey) if (output) return output