Skip to content

Commit 9066947

Browse files
authored
Disable streaming for SSG (#10796)
1 parent 1ce2288 commit 9066947

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

Diff for: .changeset/eight-hotels-try.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"astro": patch
3+
---
4+
5+
Disables streaming when rendering site with `output: "static"`

Diff for: packages/astro/src/core/build/pipeline.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ export class BuildPipeline extends Pipeline {
5353
return assetLink;
5454
}
5555
const serverLike = isServerLikeOutput(config);
56-
const streaming = true;
56+
// We can skip streaming in SSG for performance as writing as strings are faster
57+
const streaming = serverLike;
5758
super(
5859
options.logger,
5960
manifest,

Diff for: packages/astro/src/runtime/server/render/astro/render.ts

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ export async function renderToString(
3131
let str = '';
3232
let renderedFirstPageChunk = false;
3333

34+
if (isPage) {
35+
await bufferHeadContent(result);
36+
}
37+
3438
const destination: RenderDestination = {
3539
write(chunk) {
3640
// Automatic doctype insertion for pages

Diff for: packages/astro/test/content-collections-render.test.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ import * as assert from 'node:assert/strict';
22
import { after, before, describe, it } from 'node:test';
33
import * as cheerio from 'cheerio';
44
import testAdapter from './test-adapter.js';
5-
import { isWindows, loadFixture } from './test-utils.js';
6-
7-
if (!isWindows) {
8-
describe();
9-
}
5+
import { loadFixture } from './test-utils.js';
106

117
describe('Content Collections - render()', () => {
128
describe('Build - SSG', () => {

0 commit comments

Comments
 (0)