@@ -3,7 +3,7 @@ import path from 'node:path';
33import { URL } from 'node:url' ;
44import colors from 'kleur' ;
55import sirv from 'sirv' ;
6- import { isCSSRequest , loadEnv } from 'vite' ;
6+ import { isCSSRequest , loadEnv , buildErrorMessage } from 'vite' ;
77import { getRequest , setResponse } from '../../../exports/node/index.js' ;
88import { installPolyfills } from '../../../exports/node/polyfills.js' ;
99import { coalesce_to_error } from '../../../utils/error.js' ;
@@ -50,23 +50,18 @@ export async function dev(vite, vite_config, svelte_config) {
5050 /** @type {Error | null } */
5151 let manifest_error = null ;
5252
53- /**
54- * @param {any } e
55- */
56- const outputModuleLoadError = ( e ) => {
57- let msg = colors . red ( ( e . plugin ? `[${ e . plugin } ] ` : '' ) + e . message ) ;
58- if ( e . id ) {
59- msg += `\nfile: ${ colors . cyan ( e . id + ( e . loc ? `:${ e . loc . line } :${ e . loc . column } ` : '' ) ) } ` ;
60- }
61- if ( e . frame ) {
62- msg += `\n` + colors . yellow ( e . frame ) ;
63- }
53+ /** @param {any } err */
54+ function outputModuleLoadError ( err ) {
55+ const msg = buildErrorMessage ( err , [ colors . red ( `Internal server error: ${ err . message } ` ) ] ) ;
56+
57+ vite . config . logger . error ( msg , {
58+ error : err
59+ } ) ;
6460 vite . ws . send ( {
6561 type : 'error' ,
66- err : e
62+ err : err
6763 } ) ;
68- vite . config . logger . error ( msg , { error : e } ) ;
69- } ;
64+ }
7065
7166 /** @param {string } id */
7267 async function resolve ( id ) {
0 commit comments