@@ -362,8 +362,6 @@ if (import.meta.hot) {
362362 // It is possible to get into a situation where the dev server is restarted by a config file change
363363 // right in the middle of the Vite server and the supporting Workers being initialized.
364364 // We use an abort controller to signal to the initialization code that it should stop if the config has changed.
365- const restartAbortController = new AbortController ( ) ;
366-
367365 // We use a `configId` to help debug how the config changes are triggering the restarts.
368366 const configId = randomUUID ( ) ;
369367
@@ -387,20 +385,12 @@ if (import.meta.hot) {
387385 ) {
388386 debuglog ( configId , "Config changed: " + changedFilePath ) ;
389387 viteDevServer . watcher . off ( "change" , configChangedHandler ) ;
390- if ( ! restartAbortController . signal . aborted ) {
391- debuglog (
392- configId ,
393- "Restarting dev server and aborting previous setup"
394- ) ;
395- restartAbortController . abort ( ) ;
396- await viteDevServer . watcher . close ( ) ;
397- await viteDevServer . restart ( ) ;
398- } else {
399- debuglog (
400- configId ,
401- "Config changed but already aborted previous setup, ignoring."
402- ) ;
403- }
388+ debuglog (
389+ configId ,
390+ "Restarting dev server and aborting previous setup"
391+ ) ;
392+ await viteDevServer . watcher . close ( ) ;
393+ await viteDevServer . restart ( ) ;
404394 }
405395 } ;
406396 viteDevServer . watcher . on ( "change" , configChangedHandler ) ;
@@ -425,16 +415,6 @@ if (import.meta.hot) {
425415 containerBuildId,
426416 } ) ;
427417
428- if ( restartAbortController . signal . aborted ) {
429- debuglog (
430- configId ,
431- "Aborting setting up miniflare because config has changed."
432- ) ;
433- // The config has changed while we were still trying to setup the server,
434- // so just abort and allow the new server to be set up instead.
435- return ;
436- }
437-
438418 if ( ! miniflare ) {
439419 debuglog ( configId , "Creating new Miniflare instance" ) ;
440420 miniflare = new Miniflare ( miniflareDevOptions ) ;
@@ -446,16 +426,6 @@ if (import.meta.hot) {
446426
447427 let preMiddleware : vite . Connect . NextHandleFunction | undefined ;
448428
449- if ( restartAbortController . signal . aborted ) {
450- debuglog (
451- configId ,
452- "Aborting setting up the dev server because config has changed."
453- ) ;
454- // The config has changes while this was still trying to setup the server.
455- // So just abort and allow the new server to be set up.
456- return ;
457- }
458-
459429 if ( resolvedPluginConfig . type === "workers" ) {
460430 assert ( entryWorkerConfig , `No entry Worker config` ) ;
461431
0 commit comments