Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .changeset/sweet-spoons-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/adapter-node': patch
---

fix: disable gzip and brotli when precompress=false
1 change: 1 addition & 0 deletions packages/adapter-node/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import './ambient.js';

declare global {
const ENV_PREFIX: string;
const PRECOMPRESS: boolean;
}

interface AdapterOptions {
Expand Down
3 changes: 2 additions & 1 deletion packages/adapter-node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ export default function (opts = {}) {
MANIFEST: './server/manifest.js',
SERVER: './server/index.js',
SHIMS: './shims.js',
ENV_PREFIX: JSON.stringify(envPrefix)
ENV_PREFIX: JSON.stringify(envPrefix),
PRECOMPRESS: JSON.stringify(precompress)
}
});

Expand Down
5 changes: 3 additions & 2 deletions packages/adapter-node/src/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { env } from 'ENV';
import { parse_as_bytes } from '../utils.js';

/* global ENV_PREFIX */
/* global PRECOMPRESS */

const server = new Server(manifest);

Expand Down Expand Up @@ -47,8 +48,8 @@ function serve(path, client = false) {
return fs.existsSync(path)
? sirv(path, {
etag: true,
gzip: true,
brotli: true,
gzip: PRECOMPRESS,
brotli: PRECOMPRESS,
setHeaders: client
? (res, pathname) => {
// only apply to build directory, not e.g. version.json
Expand Down
Loading