@@ -391,32 +391,26 @@ export async function dev(vite, vite_config, svelte_config) {
391
391
} ;
392
392
393
393
vite . middlewares . use ( ( req , res , next ) => {
394
- try {
395
- const base = `${ vite . config . server . https ? 'https' : 'http' } ://${
396
- req . headers [ ':authority' ] || req . headers . host
397
- } `;
394
+ const base = `${ vite . config . server . https ? 'https' : 'http' } ://${
395
+ req . headers [ ':authority' ] || req . headers . host
396
+ } `;
398
397
399
- const decoded = decodeURI ( new URL ( base + req . url ) . pathname ) ;
398
+ const decoded = decodeURI ( new URL ( base + req . url ) . pathname ) ;
400
399
401
- if ( decoded . startsWith ( assets ) ) {
402
- const pathname = decoded . slice ( assets . length ) ;
403
- const file = svelte_config . kit . files . assets + pathname ;
400
+ if ( decoded . startsWith ( assets ) ) {
401
+ const pathname = decoded . slice ( assets . length ) ;
402
+ const file = svelte_config . kit . files . assets + pathname ;
404
403
405
- if ( fs . existsSync ( file ) && ! fs . statSync ( file ) . isDirectory ( ) ) {
406
- if ( has_correct_case ( file , svelte_config . kit . files . assets ) ) {
407
- req . url = encodeURI ( pathname ) ; // don't need query/hash
408
- asset_server ( req , res ) ;
409
- return ;
410
- }
404
+ if ( fs . existsSync ( file ) && ! fs . statSync ( file ) . isDirectory ( ) ) {
405
+ if ( has_correct_case ( file , svelte_config . kit . files . assets ) ) {
406
+ req . url = encodeURI ( pathname ) ; // don't need query/hash
407
+ asset_server ( req , res ) ;
408
+ return ;
411
409
}
412
410
}
413
-
414
- next ( ) ;
415
- } catch ( e ) {
416
- const error = coalesce_to_error ( e ) ;
417
- res . statusCode = 500 ;
418
- res . end ( fix_stack_trace ( error ) ) ;
419
411
}
412
+
413
+ next ( ) ;
420
414
} ) ;
421
415
422
416
const env = loadEnv ( vite_config . mode , svelte_config . kit . env . dir , '' ) ;
0 commit comments