gildas-lormeau / zip.js

JavaScript library to zip and unzip files supporting multi-core compression, compression streams, zip64, split files and encryption.
https://gildas-lormeau.github.io/zip.js
BSD 3-Clause "New" or "Revised" License
3.33k stars 506 forks source link

Provide `zip.esm.min.js` #441

Closed rwv closed 11 months ago

rwv commented 11 months ago

Could you please provide a zip.esm.min.js in dist/? index.js is esm but not suitable for browser usage.

gildas-lormeau commented 11 months ago

What do you mean by "not suitable for browser usage"? Here is a demo which imports index.js and works fine in browsers: https://jsfiddle.net/dns7pkxt/

gildas-lormeau commented 11 months ago

I added the file in the version 2.7.22. It is named index.min.js and located in the root folder of the project. You can find a demo here: https://jsfiddle.net/zjy1r29p/.

rwv commented 11 months ago

What do you mean by "not suitable for browser usage"? Here is a demo which imports index.js and works fine in browsers: https://jsfiddle.net/dns7pkxt/

index.js is not bundled and minified. In browser environment this will have multiple http request and increase latency.

gildas-lormeau commented 11 months ago

In 2023, as a library provider and even though I added the bundled file in the project, I consider I am not supposed to provide a bundled ES2015 module. You're supposed, as an integrator, to do this job via the toolchain of your application/website. This is one of the major features of modules, in ES2015 or Node.js.

rwv commented 11 months ago

My use case is to import @zip.js/zip.js directly in browser from public CDN like JsDelivr, increase performance and cache can be shared across sites. But you’re right, this is a niche case. Thank you again for creating such a wonderful project!

gildas-lormeau commented 11 months ago

You're welcome and thank you for your continued support!

I agree that it looks like HTTP/3 and QUIC are not yet sufficient to solve this issue today, unfortunately. I hope that in the future no one will have to use bundlers, like in the 90s :)