Vue3 defineAsyncComponent hide error message in console on fail #9608
Answered
by
Alfred-Skyblue
nexorianus
asked this question in
Help/Questions
-
Hi, I was trying to solve it like follows: const ForkedComponent = await defineAsyncComponent({
loader: () => import(`@/components/${themeName}/${compName()}.vue`),
// should not push errors to the browser console
suspensible: true,
errorComponent: defineAsyncComponent({
loader: () => import(`@/components/generic/${compName()}.vue`),
// may push errors to the browser console on fail
suspensible: true,
errorComponent: ComponentError,
timeout: 1000,
}),
timeout: 1000,
}); Has anyone an idea on how to get rid of the error thrown by the outer |
Beta Was this translation helpful? Give feedback.
Answered by
Alfred-Skyblue
Nov 15, 2023
Replies: 1 comment 1 reply
-
Try using this method: const ForkedComponent = await defineAsyncComponent({
loader: () => {
return import(`@/components/${themeName}/${compName()}.vue`).catch(
() => import(`@/components/generic/${compName()}.vue`)
)
},
suspensible: true,
errorComponent: ErrorComponent,
timeout: 1000
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
nexorianus
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try using this method: