From f4e26abb4c9cea65452022e66f34abef29c26845 Mon Sep 17 00:00:00 2001 From: Stephan Troyer Date: Wed, 9 Feb 2022 12:06:24 +0100 Subject: [PATCH 1/3] Precompress wasm files When enabling the `precompress` option, WebAssembly files currently aren't compressed. In my case however, compression brings me down from 4 MB to 1.5 MB, which seems to be in line with [what can be observed in the wild](https://almanac.httparchive.org/en/2021/webassembly#can-we-improve-compression). --- packages/adapter-static/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/adapter-static/index.js b/packages/adapter-static/index.js index a563ff343c24..58483e74bc46 100644 --- a/packages/adapter-static/index.js +++ b/packages/adapter-static/index.js @@ -50,7 +50,7 @@ export default function ({ pages = 'build', assets = pages, fallback, precompres * @param {string} directory */ async function compress(directory) { - const files = await glob('**/*.{html,js,json,css,svg,xml}', { + const files = await glob('**/*.{html,js,json,css,svg,xml,wasm}', { cwd: directory, dot: true, absolute: true, From 3bad8739be223b15e46a011767d453dca6d566cb Mon Sep 17 00:00:00 2001 From: Stephan Troyer Date: Wed, 9 Feb 2022 12:15:26 +0100 Subject: [PATCH 2/3] add changelog --- .changeset/purple-dragons-work.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/purple-dragons-work.md diff --git a/.changeset/purple-dragons-work.md b/.changeset/purple-dragons-work.md new file mode 100644 index 000000000000..bdb230219891 --- /dev/null +++ b/.changeset/purple-dragons-work.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/adapter-static': patch +--- + +`precompress` option also compress wasm files From 0892ad7acb08a3354589de20f1832c47e57817df Mon Sep 17 00:00:00 2001 From: Stephan Troyer Date: Wed, 9 Feb 2022 18:55:04 +0100 Subject: [PATCH 3/3] add wasm compression to adapter-node --- packages/adapter-node/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/adapter-node/index.js b/packages/adapter-node/index.js index fb20c7fdb0d9..70898ffcd033 100644 --- a/packages/adapter-node/index.js +++ b/packages/adapter-node/index.js @@ -78,7 +78,7 @@ async function compress(directory) { return; } - const files = await glob('**/*.{html,js,json,css,svg,xml}', { + const files = await glob('**/*.{html,js,json,css,svg,xml,wasm}', { cwd: directory, dot: true, absolute: true,