diff --git a/packages/astro/src/core/errors/dev/vite.ts b/packages/astro/src/core/errors/dev/vite.ts index 5d28ad5f8..1ae467c2c 100644 --- a/packages/astro/src/core/errors/dev/vite.ts +++ b/packages/astro/src/core/errors/dev/vite.ts @@ -122,6 +122,10 @@ export interface AstroErrorPayload { }; } +// Shiki does not support `mjs` or `cjs` aliases by default. +// Map these to `.js` during error highlighting. +const ALTERNATIVE_JS_EXTS = ['cjs', 'mjs']; + /** * Generate a payload for Vite's error overlay */ @@ -151,9 +155,7 @@ export async function getViteErrorPayload(err: ErrorWithMetadata): Promise