Skip to content

Commit 225c1ce

Browse files
authored
Precompress wasm files (#3790)
* 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). * add changelog * add wasm compression to adapter-node
1 parent feec81d commit 225c1ce

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

.changeset/purple-dragons-work.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/adapter-static': patch
3+
---
4+
5+
`precompress` option also compress wasm files

packages/adapter-node/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ async function compress(directory) {
7878
return;
7979
}
8080

81-
const files = await glob('**/*.{html,js,json,css,svg,xml}', {
81+
const files = await glob('**/*.{html,js,json,css,svg,xml,wasm}', {
8282
cwd: directory,
8383
dot: true,
8484
absolute: true,

packages/adapter-static/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default function ({ pages = 'build', assets = pages, fallback, precompres
5050
* @param {string} directory
5151
*/
5252
async function compress(directory) {
53-
const files = await glob('**/*.{html,js,json,css,svg,xml}', {
53+
const files = await glob('**/*.{html,js,json,css,svg,xml,wasm}', {
5454
cwd: directory,
5555
dot: true,
5656
absolute: true,

0 commit comments

Comments
 (0)