File tree 1 file changed +13
-4
lines changed
1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -53,9 +53,18 @@ export function parse(options: ParseOptions): SFCDescriptor {
53
53
needMap = true
54
54
} = options
55
55
const cacheKey = hash ( filename + source )
56
- let output : SFCDescriptor = cache . get ( cacheKey )
57
- if ( output ) return output
58
- output = compiler . parseComponent ( source , compilerParseOptions )
56
+ const cachedOutput : string = cache . get ( cacheKey )
57
+ if ( cachedOutput ) {
58
+ try {
59
+ return JSON . parse ( cachedOutput ) as SFCDescriptor
60
+ } catch ( _ ) {
61
+ // do nothing
62
+ }
63
+ }
64
+ const output : SFCDescriptor = compiler . parseComponent (
65
+ source ,
66
+ compilerParseOptions
67
+ )
59
68
if ( needMap ) {
60
69
if ( output . script && ! output . script . src ) {
61
70
output . script . map = generateSourceMap (
@@ -78,7 +87,7 @@ export function parse(options: ParseOptions): SFCDescriptor {
78
87
} )
79
88
}
80
89
}
81
- cache . set ( cacheKey , output )
90
+ cache . set ( cacheKey , JSON . stringify ( output ) )
82
91
return output
83
92
}
84
93
You can’t perform that action at this time.
0 commit comments