jszip
jszip copied to clipboard
nodestream not supported with 3.3.0 +
as i use [email protected] nodestream is working and is also supported with my angular 8/9 but as i update it to 3.3.0 nodestream become to false
@mgechev as the author of the PR that went into 3.3.0 could you chime in here?
Hey @Stuk, I'm lacking context; not sure what does this mean. Steps for reproduction would definitely help.
just import in Angular Application and u will see that 3.2.0 has support for nodestream and 3.3.0 does not, if u cant do it by some reason let me know
got the same error. JSzip.generateNodeStream() works well with JSZip 3.2.0, but failed with JSZip 3.3.0 & 3.4.0, throw an error: 'Error: nodestream is not supported by this platform', same as 491
seems like readable-stream redirect to stream, may be some useful informiation here776
hope who broke it will fix it, i will keep 3.2.0 till then
We are having the same issue ('Error: nodestream is not supported by this platform') and we are stuck to version 3.2 as well. Is there any news about this?
Yeah PR https://github.com/Stuk/jszip/pull/614 breaks our build too; webpack+electron. I'm using patch-package to revert the change to package.json to fix it for now.
Just to add that we are also experiencing this issue with Electron.
You can revert https://github.com/Stuk/jszip/pull/614 to get the previous behavior. Looks like doing so will break #524, #521, #477.
Sure, the workaround of patching the package.json does work, but I'm hoping we can come up with something more sustainable for Electron + webpack users. Seems like I found a fix, which is to use a resolve alias to force the node version of jszip to be bundled when targeting electron-renderer
.
In your webpack config, add something like:
module.exports = {
/// ... other config
alias: {
jszip: require.resolve('jszip/lib/index.js'),
}
}
@stuarta0 - this will work for you.
The fundamental problem is that webpack with the electron-renderer
target will use the browser field in package.json to bundle the browser version of the library. This in turn will cause any JSZip method that calls nodeStream()
to throw this error.
On the surface this is perfectly logical - the nodeStream method isn't available in the browser, and the electron renderer is a modified chromium environment. However, node streams are available in an Electron renderer environment when nodeIntegration
is enabled.
Not sure what can be done about the situation, short of better environment detection in the module itself, rather than using the browser property in package.json.
Any update on this issue? Is it still downgrading to 3.2.2 the only solution to use generateNodeStream in a browser environment?
I have same experience in node 14...
Any update on this?