Open zirlman opened 1 year ago
im have the same error:
13-2f45628bbf53fb8d.js:5 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'sqrt')
function() { function e(e) { return (e - (0 | e)) * 4294967296 | 0 } for (var t = 2, r = 0; r < 64; ) (function(e) { for (var t = Math.sqrt(e), r = 2; r <= t; r++) <--- here if (!(e % r)) return !1; return !0 } )(t) && (r < 8 && (c[r] = e(Math.pow(t, .5))), l[r] = e(Math.pow(t, 1 / 3)), r++), t++ }(),
This also breaks pdfkit when trying to generate a pdf in build. Rolling nextjs back to 14.0.1 seem to fix the problem.
Use transpilePackages: [''crypto-js'] in next.config.js file. I build project success in product mode with next js 14.3 .
Sample
Sample
it works.
I'm having issues with this library and Nextjs >= 14.0.2.
I've elaborated the issue on NextJS in detail Issue: https://github.com/vercel/next.js/issues/58623
TLDR; It looks like the module
Math.sqrt
isundefined
in your libary when ran on client-side