0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

Disable streaming for SSG (#10796)

This commit is contained in:
Bjorn Lu 2024-04-16 21:21:19 +08:00 committed by GitHub
parent 1ce22881c6
commit 90669472df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 6 deletions

View file

@ -0,0 +1,5 @@
---
"astro": patch
---
Disables streaming when rendering site with `output: "static"`

View file

@ -53,7 +53,8 @@ export class BuildPipeline extends Pipeline {
return assetLink;
}
const serverLike = isServerLikeOutput(config);
const streaming = true;
// We can skip streaming in SSG for performance as writing as strings are faster
const streaming = serverLike;
super(
options.logger,
manifest,

View file

@ -31,6 +31,10 @@ export async function renderToString(
let str = '';
let renderedFirstPageChunk = false;
if (isPage) {
await bufferHeadContent(result);
}
const destination: RenderDestination = {
write(chunk) {
// Automatic doctype insertion for pages

View file

@ -2,11 +2,7 @@ import * as assert from 'node:assert/strict';
import { after, before, describe, it } from 'node:test';
import * as cheerio from 'cheerio';
import testAdapter from './test-adapter.js';
import { isWindows, loadFixture } from './test-utils.js';
if (!isWindows) {
describe();
}
import { loadFixture } from './test-utils.js';
describe('Content Collections - render()', () => {
describe('Build - SSG', () => {