diff --git a/vue-server/README.md b/vue-server/README.md index 590979f9..8f642b01 100644 --- a/vue-server/README.md +++ b/vue-server/README.md @@ -2,6 +2,20 @@ https://vue-server-demo.hiro18181.workers.dev/ +```sh +# local dev +pnpm i +pnpm dev + +# local preview +pnpm build +pnpm preview + +# deploy cloudflare +pnpm cf-build +pnpm cf-release +``` + ## references - https://github.com/hi-ogawa/js-utils/pull/227 diff --git a/vue-server/e2e/basic.test.ts b/vue-server/e2e/basic.test.ts index 3dd5f16e..deb4f29a 100644 --- a/vue-server/e2e/basic.test.ts +++ b/vue-server/e2e/basic.test.ts @@ -20,6 +20,14 @@ testNoJs("basic @nojs", async ({ page }) => { await page.getByText("Count: 0").click(); }); +test("ssr", async ({ request }) => { + const res = await request.get("/"); + const resText = await res.text(); + expect(resText).toMatch( + /^\s*\s*
.*<\/head>\s*.*<\/body>\s*<\/html>\s*$/s, + ); +}); + test("navigation @js", async ({ page }) => { await page.goto("/"); await waitForHydration(page); @@ -84,7 +92,6 @@ async function testFormNavigation(page: Page, options: { js: boolean }) { test("hmr server @dev", async ({ page }) => { await page.goto("/"); await waitForHydration(page); - await page.pause(); // check client state is preserved await page.getByRole("button", { name: "client sfc: 0" }).click(); @@ -111,7 +118,6 @@ test("hmr server @dev", async ({ page }) => { test("hmr sfc @dev", async ({ page }) => { await page.goto("/sfc"); await waitForHydration(page); - await page.pause(); await page.getByRole("button", { name: "client counter 0" }).first().click(); await page.getByRole("button", { name: "client counter 1" }).click(); diff --git a/vue-server/src/demo/entry-server.tsx b/vue-server/src/demo/entry-server.tsx index 62dae81e..0cfcd311 100644 --- a/vue-server/src/demo/entry-server.tsx +++ b/vue-server/src/demo/entry-server.tsx @@ -25,7 +25,7 @@ export async function handler(request: Request) { const app = createSSRApp(Root); const ssrHtml = await renderToString(app); let html = (await import("virtual:index-html" as string)).default as string; - html = html.replace("", () => `