diff --git a/packages/astro/src/core/errors/dev/vite.ts b/packages/astro/src/core/errors/dev/vite.ts index 4cc430ff66..3a94f9749f 100644 --- a/packages/astro/src/core/errors/dev/vite.ts +++ b/packages/astro/src/core/errors/dev/vite.ts @@ -175,7 +175,7 @@ export async function getViteErrorPayload(err: ErrorWithMetadata): Promise('#cause'); - if (cause && err.cause) { - if (typeof err.cause === 'string') { - this.text('#cause-content', err.cause); - cause.style.display = 'block'; - } else { - this.text('#cause-content', JSON.stringify(err.cause, null, 2)); - cause.style.display = 'block'; - } - } + const cause = this.root.querySelector('#cause'); + if (cause && err.cause) { + if (typeof err.cause === 'string') { + this.text('#cause-content', err.cause); + cause.style.display = 'block'; + } else { + this.text('#cause-content', JSON.stringify(err.cause, null, 2)); + cause.style.display = 'block'; + } + } const hint = this.root.querySelector('#hint'); if (hint && err.hint) {