Skip to content

Commit

Permalink
fix(ui): handle dynamic import in renderVue3Component with try-catch …
Browse files Browse the repository at this point in the history
…due to esbuild limitations (#1518)
  • Loading branch information
jikkai authored Mar 8, 2024
1 parent 9e8cc45 commit a684e9d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/ui/src/common/component-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,18 @@ export class ComponentManager {
}

async function renderVue3Component(VueComponent: ReturnType<typeof defineComponent>, element: HTMLElement, args: Record<string, any>) {
const { h, render } = await import('vue');
try {
const { h, render } = await import('vue');

const vnode = h(VueComponent, args);
const vnode = h(VueComponent, args);

const container = document.createElement('div');
const container = document.createElement('div');

document.body.appendChild(container);
document.body.appendChild(container);

render(vnode, element);
render(vnode, element);
} catch (error) {
}
}

export function VueComponentWrapper(options: { component: ReturnType<typeof defineComponent>; props: Record<string, any> }) {
Expand Down

0 comments on commit a684e9d

Please sign in to comment.