diff options
author | 2023-10-18 21:23:19 +0800 | |
---|---|---|
committer | 2023-10-18 21:23:19 +0800 | |
commit | 65c7bd149cf9024f8026a73426d51c76be543cc4 (patch) | |
tree | 9af142c945eb48a2560ab5c2561ce87baf8a82e9 /packages/integrations/vue | |
parent | c6e0d8e1cdf58e4cc797e86fb3cc4494e2111566 (diff) | |
download | astro-65c7bd149cf9024f8026a73426d51c76be543cc4.tar.gz astro-65c7bd149cf9024f8026a73426d51c76be543cc4.tar.zst astro-65c7bd149cf9024f8026a73426d51c76be543cc4.zip |
Fix Vue HMR for script tags (#8860)
Diffstat (limited to 'packages/integrations/vue')
-rw-r--r-- | packages/integrations/vue/client.js | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/packages/integrations/vue/client.js b/packages/integrations/vue/client.js index 8b2a5eede..7e1d8090e 100644 --- a/packages/integrations/vue/client.js +++ b/packages/integrations/vue/client.js @@ -14,16 +14,20 @@ export default (element) => slots[key] = () => h(StaticHtml, { value, name: key === 'default' ? undefined : key }); } - let content = h(Component, props, slots); - // related to https://github.com/withastro/astro/issues/6549 - // if the component is async, wrap it in a Suspense component - if (isAsync(Component.setup)) { - content = h(Suspense, null, content); - } - const isHydrate = client !== 'only'; - const boostrap = isHydrate ? createSSRApp : createApp; - const app = boostrap({ name, render: () => content }); + const bootstrap = isHydrate ? createSSRApp : createApp; + const app = bootstrap({ + name, + render() { + let content = h(Component, props, slots); + // related to https://github.com/withastro/astro/issues/6549 + // if the component is async, wrap it in a Suspense component + if (isAsync(Component.setup)) { + content = h(Suspense, null, content); + } + return content; + }, + }); await setup(app); app.mount(element, isHydrate); |