diff --git a/.changeset/loud-bikes-pay.md b/.changeset/loud-bikes-pay.md new file mode 100644 index 000000000..937f14dae --- /dev/null +++ b/.changeset/loud-bikes-pay.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes uses of inline hoisted scripts in SSR diff --git a/packages/astro/src/core/app/index.ts b/packages/astro/src/core/app/index.ts index dbda3cd44..81cfe106a 100644 --- a/packages/astro/src/core/app/index.ts +++ b/packages/astro/src/core/app/index.ts @@ -80,7 +80,7 @@ export class App { const links = createLinkStylesheetElementSet(info.links, manifest.site); const filteredScripts = info.scripts.filter( - (script) => typeof script !== 'string' && script?.stage !== 'head-inline' + (script) => typeof script === 'string' || script?.stage !== 'head-inline' ) as string[]; const scripts = createModuleScriptElementWithSrcSet(filteredScripts, manifest.site); diff --git a/packages/astro/test/fixtures/ssr-hoisted-script/src/pages/index.astro b/packages/astro/test/fixtures/ssr-hoisted-script/src/pages/index.astro new file mode 100644 index 000000000..6543f0847 --- /dev/null +++ b/packages/astro/test/fixtures/ssr-hoisted-script/src/pages/index.astro @@ -0,0 +1,9 @@ + +
+