Skip to content

Commit

Permalink
fix: display slide import errors in client (#1816)
Browse files Browse the repository at this point in the history
* Make slide import errors appear in the console

* Update error message

Co-authored-by: _Kerman <kermanx@qq.com>

---------

Co-authored-by: _Kerman <kermanx@qq.com>
  • Loading branch information
AlbertBrand and KermanX authored Aug 15, 2024
1 parent 874cfd1 commit c83e649
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/slidev/node/virtual/slides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 failed to load', e); return SlideError }`,
`}`,
)
return `{ no: ${no}, meta: f${no}, load: load${no}, component: getAsyncComponent(${idx}, load${no}) }`
Expand Down

0 comments on commit c83e649

Please sign in to comment.