File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import {
1919 getSrcDescriptor ,
2020 getTempSrcDescriptor ,
2121} from './utils/descriptorCache'
22- import { getResolvedScript , typeDepToSFCMap } from './script'
22+ import { clearScriptCache , getResolvedScript , typeDepToSFCMap } from './script'
2323import { transformMain } from './main'
2424import { handleHotUpdate , handleTypeDepChange } from './handleHotUpdate'
2525import { transformTemplateAsModule } from './template'
@@ -361,5 +361,8 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin<Api> {
361361 }
362362 }
363363 } ,
364+ buildEnd ( ) {
365+ clearScriptCache ( )
366+ } ,
364367 }
365368}
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ import { cache as descriptorCache } from './utils/descriptorCache'
44import type { ResolvedOptions } from '.'
55
66// ssr and non ssr builds would output different script content
7- const clientCache = new WeakMap < SFCDescriptor , SFCScriptBlock | null > ( )
8- const ssrCache = new WeakMap < SFCDescriptor , SFCScriptBlock | null > ( )
7+ let clientCache = new WeakMap < SFCDescriptor , SFCScriptBlock | null > ( )
8+ let ssrCache = new WeakMap < SFCDescriptor , SFCScriptBlock | null > ( )
99
1010export const typeDepToSFCMap = new Map < string , Set < string > > ( )
1111
@@ -32,6 +32,11 @@ export function setResolvedScript(
3232 ; ( ssr ? ssrCache : clientCache ) . set ( descriptor , script )
3333}
3434
35+ export function clearScriptCache ( ) : void {
36+ clientCache = new WeakMap ( )
37+ ssrCache = new WeakMap ( )
38+ }
39+
3540// Check if we can use compile template as inlined render function
3641// inside <script setup>. This can only be done for build because
3742// inlined template cannot be individually hot updated.
You can’t perform that action at this time.
0 commit comments