File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -18,19 +18,19 @@ export function isVirtualModuleId(encoded: string, plugin: ResolvedUnpluginOptio
1818export class FakeVirtualModulesPlugin {
1919 name = 'FakeVirtualModulesPlugin'
2020 static counters : Map < string , number > = new Map < string , number > ( )
21+ static initCleanup : boolean = false
2122
22- static {
23- [ 'SIGINT' , 'SIGTERM' , 'SIGQUIT' , 'exit' ] . forEach ( ( event ) => {
24- process . once ( event , ( ) => {
25- this . counters . forEach ( ( _ , dir ) => {
23+ constructor ( private plugin : ResolvedUnpluginOptions ) {
24+ if ( ! FakeVirtualModulesPlugin . initCleanup ) {
25+ FakeVirtualModulesPlugin . initCleanup = true
26+ process . once ( 'exit' , ( ) => {
27+ FakeVirtualModulesPlugin . counters . forEach ( ( _ , dir ) => {
2628 fs . rmSync ( dir , { recursive : true , force : true } )
2729 } )
2830 } )
29- } )
31+ }
3032 }
3133
32- constructor ( private plugin : ResolvedUnpluginOptions ) { }
33-
3434 apply ( compiler : Compiler ) : void {
3535 const dir = this . plugin . __virtualModulePrefix
3636 if ( ! fs . existsSync ( dir ) ) {
You can’t perform that action at this time.
0 commit comments