@@ -260,20 +260,38 @@ def do_GET(self):
260260 if not file_path .exists () and not "." in path .split ("/" )[- 1 ]:
261261 self .path = "/index.html"
262262
263- return super ().do_GET ()
263+ try :
264+ return super ().do_GET ()
265+ except BrokenPipeError :
266+ pass # Client disconnected, ignore
264267
265268 def log_message (self , format , * args ):
266- # Quieter logging
267- if args [1 ] != "200" :
268- print (f"[server] { args [0 ]} { args [1 ]} " )
269+ # Suppress noisy 404s for source maps, favicons, DevTools files
270+ path = args [0 ] if args else ""
271+ status = args [1 ] if len (args ) > 1 else ""
272+
273+ # Files we don't care about 404s for
274+ ignored = (".map" , "favicon.ico" , ".well-known" , "chrome-devtools" )
275+ if status == "404" and any (x in path for x in ignored ):
276+ return
277+
278+ # Only log non-200 status
279+ if status != "200" :
280+ print (f"[server] { path } { status } " )
281+
282+ def handle (self ):
283+ try :
284+ super ().handle ()
285+ except BrokenPipeError :
286+ pass # Suppress broken pipe errors
269287
270288
271289def serve_dist (host : str = "127.0.0.1" , port : int = 3000 ):
272290 os .chdir (str (DIST ))
273291 handler = SPAHandler
274292 httpd = socketserver .TCPServer ((host , port ), handler )
275293 url = f"http://{ host } :{ port } "
276- print (f"[server] Serving at { url } " )
294+ print (f"[server] Dev server running at { url } " )
277295 webbrowser .open (url )
278296 try :
279297 httpd .serve_forever ()
0 commit comments