From c8e7a451f51e2f3de5b12b77d87d97622c314540 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Fri, 8 Mar 2024 08:10:06 -0800 Subject: [PATCH 1/3] docs: describe how to compress adapter-node responses --- documentation/docs/25-build-and-deploy/40-adapter-node.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/documentation/docs/25-build-and-deploy/40-adapter-node.md b/documentation/docs/25-build-and-deploy/40-adapter-node.md index 44d0ff46dfed..0d57a5542e23 100644 --- a/documentation/docs/25-build-and-deploy/40-adapter-node.md +++ b/documentation/docs/25-build-and-deploy/40-adapter-node.md @@ -32,6 +32,10 @@ node build Development dependencies will be bundled into your app using [Rollup](https://rollupjs.org). To control whether a given package is bundled or externalised, place it in `devDependencies` or `dependencies` respectively in your `package.json`. +### Compressing responses + +You will typically want to compress responses coming from the server. You will often deploy your server behind a load balancer or reverse proxy. Since Node.js is single-threaded, it typically results in better performance to handle compression at that layer rather than directly in the server. If you build a [#custom-server](custom server) and do want to add a compression middleware there, note that we would recommend using `@polka/compression` since SvelteKit streams responses and the `compression` package does not support streaming and may error when used. + ## Environment variables In `dev` and `preview`, SvelteKit will read environment variables from your `.env` file (or `.env.local`, or `.env.[mode]`, [as determined by Vite](https://vitejs.dev/guide/env-and-mode.html#env-files).) From c044706ffd6a14bd3b85b5d6f121e90a90ca9cf5 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Fri, 8 Mar 2024 09:09:14 -0800 Subject: [PATCH 2/3] Update documentation/docs/25-build-and-deploy/40-adapter-node.md Co-authored-by: Conduitry --- documentation/docs/25-build-and-deploy/40-adapter-node.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/documentation/docs/25-build-and-deploy/40-adapter-node.md b/documentation/docs/25-build-and-deploy/40-adapter-node.md index 0d57a5542e23..be49451e1699 100644 --- a/documentation/docs/25-build-and-deploy/40-adapter-node.md +++ b/documentation/docs/25-build-and-deploy/40-adapter-node.md @@ -34,7 +34,9 @@ Development dependencies will be bundled into your app using [Rollup](https://ro ### Compressing responses -You will typically want to compress responses coming from the server. You will often deploy your server behind a load balancer or reverse proxy. Since Node.js is single-threaded, it typically results in better performance to handle compression at that layer rather than directly in the server. If you build a [#custom-server](custom server) and do want to add a compression middleware there, note that we would recommend using `@polka/compression` since SvelteKit streams responses and the `compression` package does not support streaming and may error when used. +You will typically want to compress responses coming from the server. If you are already deploying your server behind a reverse proxy for SSL or load balancing, it typically results in better performance to also handle compression at that layer since Node.js is single-threaded. + +However, if you're building a [#custom-server](custom server) and do want to add a compression middleware there, note that we would recommend using [`@polka/compression`](https://www.npmjs.com/package/@polka/compression) since SvelteKit streams responses and the more popular [`compression`](https://www.npmjs.com/package/compression) package does not support streaming and may cause errors when used. ## Environment variables From 683127494aa16dd0c957e362ac1680593405ce5a Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Fri, 8 Mar 2024 09:19:49 -0800 Subject: [PATCH 3/3] Update documentation/docs/25-build-and-deploy/40-adapter-node.md --- documentation/docs/25-build-and-deploy/40-adapter-node.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/25-build-and-deploy/40-adapter-node.md b/documentation/docs/25-build-and-deploy/40-adapter-node.md index be49451e1699..8b8e9f598308 100644 --- a/documentation/docs/25-build-and-deploy/40-adapter-node.md +++ b/documentation/docs/25-build-and-deploy/40-adapter-node.md @@ -36,7 +36,7 @@ Development dependencies will be bundled into your app using [Rollup](https://ro You will typically want to compress responses coming from the server. If you are already deploying your server behind a reverse proxy for SSL or load balancing, it typically results in better performance to also handle compression at that layer since Node.js is single-threaded. -However, if you're building a [#custom-server](custom server) and do want to add a compression middleware there, note that we would recommend using [`@polka/compression`](https://www.npmjs.com/package/@polka/compression) since SvelteKit streams responses and the more popular [`compression`](https://www.npmjs.com/package/compression) package does not support streaming and may cause errors when used. +However, if you're building a [#custom-server](custom server) and do want to add a compression middleware there, note that we would recommend using [`@polka/compression`](https://www.npmjs.com/package/@polka/compression) since SvelteKit streams responses and the more popular `compression` package does not support streaming and may cause errors when used. ## Environment variables