File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ interface LaravelPlugin extends Plugin {
4141 config : ( config : UserConfig , env : ConfigEnv ) => UserConfig
4242}
4343
44+ let exitHandlersBound = false
45+
4446/**
4547 * Laravel plugin for Vite.
4648 *
@@ -130,25 +132,22 @@ export default function laravel(config: string|string[]|PluginConfig): LaravelPl
130132 }
131133 } )
132134
135+ if ( exitHandlersBound ) {
136+ return
137+ }
138+
133139 const clean = ( ) => {
134140 if ( fs . existsSync ( hotFile ) ) {
135141 fs . rmSync ( hotFile )
136142 }
137143 }
138144
139145 process . on ( 'exit' , clean )
140- process . on ( 'SIGHUP' , ( ) => {
141- clean ( )
142- process . exit ( )
143- } )
144- process . on ( 'SIGINT' , ( ) => {
145- clean ( )
146- process . exit ( )
147- } )
148- process . on ( 'SIGTERM' , ( ) => {
149- clean ( )
150- process . exit ( )
151- } )
146+ process . on ( 'SIGINT' , process . exit )
147+ process . on ( 'SIGTERM' , process . exit )
148+ process . on ( 'SIGHUP' , process . exit )
149+
150+ exitHandlersBound = true
152151 } ,
153152
154153 // The following two hooks are a workaround to help solve a "flash of unstyled content" with Blade.
You can’t perform that action at this time.
0 commit comments