You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a React JS project that incorporates JSZip and everything is great when I run it locally. But when it gets deployed to the server for whatever reason the click handler it resides inside of cannot make it past const zip = new JSZip() and I see the following error in the console:
I am importing the module at the top of the page as : import JSZip from 'jszip' and it is running 3.10.1. Any help is appreciated.`
The text was updated successfully, but these errors were encountered:
Hi @mplatt212, I had the same issue, I fixed it by using dynamic imports like this:
const JSZip = await import('jszip/dist/jszip');
// because JSZip it is a module, .default is required
const jsZip = new JSZip.default(); // this line replace const zip = new JSZip();
do not forget to remove the import JSZip from 'jszip';
Adding in a comment here with specific keywords that would have saved me a bunch of time :)
The comment from @jhonman681 really helped. The context for me was:
I was upgrading an AWS lambda function from node 14 (node.js 14) to node 20 (node.js 20). I use JSZip for zipping up files, and naturally the old require('jszip') didn't work. This is what ended up working for me:
I have a React JS project that incorporates JSZip and everything is great when I run it locally. But when it gets deployed to the server for whatever reason the click handler it resides inside of cannot make it past
const zip = new JSZip()
and I see the following error in the console:I am importing the module at the top of the page as :
import JSZip from 'jszip'
and it is running 3.10.1. Any help is appreciated.`The text was updated successfully, but these errors were encountered: