Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: update test case
  • Loading branch information
yoyo837 authored and natemoo-re committed Dec 4, 2023
commit 97af50cce2e7fc442804743fa260c200dc34b86f
7 changes: 4 additions & 3 deletions packages/integrations/vue/client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { h, createSSRApp, createApp, Suspense } from 'vue';
import virtualVueApp from 'virtual:@astrojs/vue/app';
import * as virtualApp from 'virtual:@astrojs/vue/app';
import StaticHtml from './static-html.js';

export default (element) =>
Expand Down Expand Up @@ -29,8 +29,9 @@ export default (element) =>
},
});

if (typeof virtualVueApp?.setup === 'function') {
await virtualVueApp.setup(app);
const setup = virtualApp.default;
if (typeof setup === 'function') {
await setup(app);
}
app.mount(element, isHydrate);

Expand Down
7 changes: 4 additions & 3 deletions packages/integrations/vue/server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { h, createSSRApp } from 'vue';
import { renderToString } from 'vue/server-renderer';
import virtualVueApp from 'virtual:@astrojs/vue/app';
import * as virtualApp from 'virtual:@astrojs/vue/app';
import StaticHtml from './static-html.js';

function check(Component) {
Expand All @@ -21,8 +21,9 @@ async function renderToStaticMarkup(Component, inputProps, slotted, metadata) {
});
}
const app = createSSRApp({ render: () => h(Component, props, slots) });
if (typeof virtualVueApp?.setup === 'function') {
await virtualVueApp.setup(app);
const setup = virtualApp.default;
if (typeof setup === 'function') {
await setup(app);
}
const html = await renderToString(app);
return { html };
Expand Down
4 changes: 2 additions & 2 deletions packages/integrations/vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ function virtualAppEntrypoint(options?: Options) {
if (id === resolvedVirtualModuleId) {
if (options?.appEntrypoint) {
return `
import __setup from "${options.appEntrypoint}";
import * as _virtualApp from "${options.appEntrypoint}";
export const setup = (app) => {
__setup?.(app);
_virtualApp.default?.(app);
};
`;
}
Expand Down