diff --git a/.changeset/fifty-socks-end.md b/.changeset/fifty-socks-end.md new file mode 100644 index 0000000000..5afb9524f1 --- /dev/null +++ b/.changeset/fifty-socks-end.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Only escape the script tag ETAGO delimiter and opening HTML comment syntax in server islands to reduce encoding work. diff --git a/packages/astro/src/runtime/server/render/server-islands.ts b/packages/astro/src/runtime/server/render/server-islands.ts index 52b6b006e1..f8a084d928 100644 --- a/packages/astro/src/runtime/server/render/server-islands.ts +++ b/packages/astro/src/runtime/server/render/server-islands.ts @@ -14,13 +14,19 @@ export function containsServerDirective(props: Record) { return 'server:component-directive' in props; } +const scriptRegex = /<\/script/giu; +const commentRegex = /