jszip icon indicating copy to clipboard operation
jszip copied to clipboard

generateAsync not work and no error thrown on v3.10.0 and v3.10.1

Open void285 opened this issue 2 years ago • 6 comments

It works on v3.9.1 or v3.7.1, but v3.10.x not work. I didn't try more previous versions.

void285 avatar Sep 24 '22 04:09 void285

It works on v3.9.1 or v3.7.1, but v3.10.x not work. I didn't try more previous versions.

I am the same as you, and I try to reduce the version to the same effect. It only appears in the production environment. The development environment is running normally

leowang1028 avatar Dec 16 '22 02:12 leowang1028

It works on v3.9.1 or v3.7.1, but v3.10.x not work. I didn't try more previous versions.

I am the same as you, and I try to reduce the version to the same effect. It only appears in the production environment. The development environment is running normally

I have the same prob, its work on dev but not prod, i guess the error caused by build.

damnwenxi avatar Jan 06 '23 06:01 damnwenxi

I'm having the same issue on dev with NextJS. I get a zip but it's not at all compressed using

const zipBlob = await zip.generateAsync({
   compression: "DEFLATE",
    compressionOptions: {
        level: 9
    }
});

sudoryan avatar Jan 31 '23 20:01 sudoryan

The exact same issue. Used in Tampermonkey '@require'. Downgrade from 3.10.1 to 3.9.1 and it works fine.

owendswang avatar Feb 28 '23 13:02 owendswang

If you're using JSZip in some kind of browser sandboxed environment such as a userscript engine (e.g. Tampermonkey) JSZip v3.10+ will break because the new dependency setimmediate breaks in that case. This is explained in Tampermonkey issue #1600 along with a workaround. I'll post a new issue highlighting this.

edyhchan avatar Sep 29 '23 06:09 edyhchan

Yes, it's because the setImmediate dependency, and as a solution, I used "transpileDependencies: [/[/\]node_modules/\?jszip(.*)/]", in the vue.config.js in my vue project, and it worked. If it's a react project or something, I believe you can use similar way to transpile the JSZip dependency specifically.

444171810 avatar Nov 23 '23 03:11 444171810