From ee5d84a665af0b689a92862bf23df21c6577970a Mon Sep 17 00:00:00 2001 From: yoyo837 Date: Tue, 10 Oct 2023 23:12:01 +0800 Subject: [PATCH] chore: improve app setup call --- packages/integrations/vue/client.js | 4 +++- packages/integrations/vue/server.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/integrations/vue/client.js b/packages/integrations/vue/client.js index 8b2a5eede..3e7be2bf9 100644 --- a/packages/integrations/vue/client.js +++ b/packages/integrations/vue/client.js @@ -24,7 +24,9 @@ export default (element) => const isHydrate = client !== 'only'; const boostrap = isHydrate ? createSSRApp : createApp; const app = boostrap({ name, render: () => content }); - await setup(app); + if (typeof setup === 'function') { + await setup(app); + } app.mount(element, isHydrate); element.addEventListener('astro:unmount', () => app.unmount(), { once: true }); diff --git a/packages/integrations/vue/server.js b/packages/integrations/vue/server.js index 4e06baa5f..51797ec73 100644 --- a/packages/integrations/vue/server.js +++ b/packages/integrations/vue/server.js @@ -19,7 +19,9 @@ async function renderToStaticMarkup(Component, props, slotted, metadata) { }); } const app = createSSRApp({ render: () => h(Component, props, slots) }); - await setup(app); + if (typeof setup === 'function') { + await setup(app); + } const html = await renderToString(app); return { html }; }