diff --git a/.changeset/cyan-beans-bake.md b/.changeset/cyan-beans-bake.md
new file mode 100644
index 0000000..e0dba7f
--- /dev/null
+++ b/.changeset/cyan-beans-bake.md
@@ -0,0 +1,5 @@
+---
+"@marko/vite": patch
+---
+
+Fix issue with generated server entry code when using tags api.
diff --git a/src/server-entry-template.ts b/src/server-entry-template.ts
index 0de1a7c..35c37dd 100644
--- a/src/server-entry-template.ts
+++ b/src/server-entry-template.ts
@@ -15,7 +15,7 @@ import { addAssets } from "${renderAssetsRuntimeId}";
${opts.tagsAPI ? `` : `$ const writeSync = ${addAssetsCall};`}
-
+${opts.tagsAPI ? "" : ""}
$!{
$global.___viteRenderAssets("head-prepend") +
$global.___viteRenderAssets("head") +
@@ -40,7 +40,7 @@ ${opts.tagsAPI ? `` : `$ const writeSync = ${
`
}
-
+${opts.tagsAPI ? "" : ""}
$!{$global.___viteRenderAssets("body")}
>