Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance by compressing in parallel #6710

Merged
merged 7 commits into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/adapter-node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ export default function (opts = {}) {

if (precompress) {
builder.log.minor('Compressing assets');
await builder.compress(`${out}/client`);
await builder.compress(`${out}/prerendered`);
await Promise.allSettled([
sanjaiyan-dev marked this conversation as resolved.
Show resolved Hide resolved
builder.compress(`${out}/client`),
builder.compress(`${out}/prerendered`)
]);
}

builder.log.minor('Building server');
Expand Down
8 changes: 2 additions & 6 deletions packages/adapter-static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,11 @@ export default function (options) {
builder.writePrerendered(pages, { fallback });

if (precompress) {
builder.log.minor('Compressing assets and pages');
if (pages === assets) {
builder.log.minor('Compressing assets and pages');
await builder.compress(assets);
} else {
builder.log.minor('Compressing assets');
await builder.compress(assets);

builder.log.minor('Compressing pages');
await builder.compress(pages);
await Promise.allSettled([builder.compress(assets), builder.compress(pages)]);
}
}

Expand Down