File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,11 @@ import { version } from '../../package.json'
11
11
import { resolveCompiler } from '../core/compiler'
12
12
import { EXPORT_HELPER_ID , helperCode } from '../core/helper'
13
13
import { transformMain } from '../core/main'
14
- import { getResolvedScript , typeDepToSFCMap } from '../core/script'
14
+ import {
15
+ clearScriptCache ,
16
+ getResolvedScript ,
17
+ typeDepToSFCMap ,
18
+ } from '../core/script'
15
19
import { transformStyle } from '../core/style'
16
20
import { transformTemplateAsModule } from '../core/template'
17
21
import { handleHotUpdate , handleTypeDepChange } from './handleHotUpdate'
@@ -397,6 +401,10 @@ export const plugin = createUnplugin<Options | undefined, false>(
397
401
}
398
402
}
399
403
} ,
404
+
405
+ buildEnd ( ) {
406
+ clearScriptCache ( )
407
+ } ,
400
408
}
401
409
} ,
402
410
)
Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ import type { UnpluginContextMeta } from 'unplugin'
5
5
import type { SFCDescriptor , SFCScriptBlock } from 'vue/compiler-sfc'
6
6
7
7
// ssr and non ssr builds would output different script content
8
- const clientCache = new WeakMap < SFCDescriptor , SFCScriptBlock | null > ( )
9
- const ssrCache = new WeakMap < SFCDescriptor , SFCScriptBlock | null > ( )
8
+ let clientCache = new WeakMap < SFCDescriptor , SFCScriptBlock | null > ( )
9
+ let ssrCache = new WeakMap < SFCDescriptor , SFCScriptBlock | null > ( )
10
10
11
11
export const typeDepToSFCMap = new Map < string , Set < string > > ( )
12
12
@@ -33,6 +33,11 @@ export function setResolvedScript(
33
33
; ( ssr ? ssrCache : clientCache ) . set ( descriptor , script )
34
34
}
35
35
36
+ export function clearScriptCache ( ) : void {
37
+ clientCache = new WeakMap ( )
38
+ ssrCache = new WeakMap ( )
39
+ }
40
+
36
41
// Check if we can use compile template as inlined render function
37
42
// inside <script setup>. This can only be done for build because
38
43
// inlined template cannot be individually hot updated.
You can’t perform that action at this time.
0 commit comments