diff --git a/.changeset/breezy-plums-clap.md b/.changeset/breezy-plums-clap.md new file mode 100644 index 000000000000..d6d3f4b26aa8 --- /dev/null +++ b/.changeset/breezy-plums-clap.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes a case where the error overlay would not escape the message diff --git a/packages/astro/src/core/errors/dev/vite.ts b/packages/astro/src/core/errors/dev/vite.ts index 56688877a861..9063e45b7079 100644 --- a/packages/astro/src/core/errors/dev/vite.ts +++ b/packages/astro/src/core/errors/dev/vite.ts @@ -105,6 +105,7 @@ export function enhanceViteSSRError({ } export interface AstroErrorPayload { + __isEnhancedAstroErrorPayload: true; type: ErrorPayload['type']; err: Omit & { name?: string; @@ -164,6 +165,7 @@ export async function getViteErrorPayload(err: ErrorWithMetadata): Promise { + events.emit('hmr-error', { + type: 'error', + err: { + message: payload.err.message, + stack: payload.err.stack, + }, + }); + + args[0] = payload; + _wsSend.apply(this, args); + }); + return; + } events.emit('hmr-error', msg); } _wsSend.apply(this, args);