From e2470191d3764e3e7a09990a7c9d89f636bf0fcc Mon Sep 17 00:00:00 2001 From: Albert Brand Date: Tue, 13 Aug 2024 15:42:12 +0200 Subject: [PATCH 1/2] Make slide import errors appear in the console --- packages/slidev/node/virtual/slides.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/slidev/node/virtual/slides.ts b/packages/slidev/node/virtual/slides.ts index 8767f05d7f..fba99468c9 100644 --- a/packages/slidev/node/virtual/slides.ts +++ b/packages/slidev/node/virtual/slides.ts @@ -27,7 +27,7 @@ export const templateSlides: VirtualModuleTemplate = { // For some unknown reason, import error won't be caught by the error component. Catch it here. `const load${no} = async () => {`, ` try { return componentsCache[${idx}] ??= await import('${VIRTUAL_SLIDE_PREFIX}${no}/md') }`, - ` catch (e) { return SlideError }`, + ` catch (e) { console.error('slide import failed', e); return SlideError }`, `}`, ) return `{ no: ${no}, meta: f${no}, load: load${no}, component: getAsyncComponent(${idx}, load${no}) }` From 825e71d9e749f99c4dd2d625c879729dcb3eb187 Mon Sep 17 00:00:00 2001 From: Albert Brand Date: Tue, 13 Aug 2024 15:49:47 +0200 Subject: [PATCH 2/2] Update error message Co-authored-by: _Kerman --- packages/slidev/node/virtual/slides.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/slidev/node/virtual/slides.ts b/packages/slidev/node/virtual/slides.ts index fba99468c9..6f11d55d03 100644 --- a/packages/slidev/node/virtual/slides.ts +++ b/packages/slidev/node/virtual/slides.ts @@ -27,7 +27,7 @@ export const templateSlides: VirtualModuleTemplate = { // For some unknown reason, import error won't be caught by the error component. Catch it here. `const load${no} = async () => {`, ` try { return componentsCache[${idx}] ??= await import('${VIRTUAL_SLIDE_PREFIX}${no}/md') }`, - ` catch (e) { console.error('slide import failed', e); return SlideError }`, + ` catch (e) { console.error('slide failed to load', e); return SlideError }`, `}`, ) return `{ no: ${no}, meta: f${no}, load: load${no}, component: getAsyncComponent(${idx}, load${no}) }`