thom4parisot / crx

A node.js command line app for packing Google Chrome extensions.
https://npmjs.com/crx
MIT License
516 stars 70 forks source link

Reduce CRX size by setting zlib compression level #128

Closed scholtzm closed 3 years ago

scholtzm commented 3 years ago

I tested packaging our extension using the built-in tool in Chrome browser vs. this module and the size difference can be pretty large -- in our case it's ~700kB smaller when using the Chrome browser.

After short investigation, I have found out that if you pass level 9 ("best compression") to zlib, size of the package will be reduced to similar size. The CRX will load just fine in Chrome browser.

For now, I have hard patched the module in node_modules folder but this is not ideal.

https://github.com/oncletom/crx/blob/master/src/index.js#L130

- var archive = archiver("zip");
+ var archive = archiver("zip", { zlib: { level: 9 }});
thom4parisot commented 3 years ago

Hi there,

Can you open a pull request with this exact change?

Otherwise I’ll do it when I get my computer out of repair.