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.38k stars 510 forks source link

Tests fail after upgrading 2.3.18 ==> 2.5.x/2.6.x #347

Closed doelgonzo closed 2 years ago

doelgonzo commented 2 years ago

I'm getting an error after upgrading from 2.3.18 to 2.6.8 which is as follows:

● Test suite failed to run

    TypeError: Class extends value undefined is not a constructor or null

    > 1 | import Zip from '@zip.js/zip.js/dist/zip.min.js'
        | ^

      at node_modules/@zip.js/zip.js/dist/zip.min.js:1:2284
      at node_modules/@zip.js/zip.js/dist/zip.min.js:1:152
      at Object.<anonymous> (node_modules/@zip.js/zip.js/dist/zip.min.js:1:288)

I backtracked to find the last working version and found it to be 2.4.26, which I will be leaving my code at, and this error pops up on 2.5.0 and above. We're trying to understand what changed that is bringing about this failure. Searching this error seemed to mention it possibly being related to circular dependencies, but my project doesn't have any...

Any help is appreciated.

gildas-lormeau commented 2 years ago

This error is due to the fact that zip.js relies now on Streams since the version 2.5. You have two options:

doelgonzo commented 2 years ago

Makes sense. Thank you! Would it be worth writing it somewhere in the Readme, or maybe having the following in the package.json?

"engines" : {
    "node" : ">=18.0.0"
  }
gildas-lormeau commented 2 years ago

Thank you for the suggestion, I'm going to add the entry in the package.json file.

For the record, I added a note in the release of the 2.5.x version (see https://github.com/gildas-lormeau/zip.js/releases/tag/v2.5.2) but I incremented versions much more than I was expecting.

gildas-lormeau commented 2 years ago

I released the version v2.6.9 with the "engines" entry in the package.json file.