rollup-plugin-web-worker-loader icon indicating copy to clipboard operation
rollup-plugin-web-worker-loader copied to clipboard

`RangeError: Maximum call stack size exceeded` with `enableUnicode: true`

Open mattrossman opened this issue 2 years ago • 0 comments

I'm bundling some code from mathjs which uses unicode variable names 🥲 . In order to use this code for an inline browser target, I have to set enableUnicode: true so it can base64 encode/decode it properly. I understand this makes the size much larger.

It builds ok, but when I run it in a browser I see RangeError: Maximum call stack size exceeded in the base64 decode logic. The stacktrace indicates it occurs at the invocation of String.fromCharCode.apply() here:

https://github.com/darionco/rollup-plugin-web-worker-loader/blob/48df45336b9d2527adae5dd50f4bbfd7c19557dc/src/helper/browser/createBase64WorkerFactory.js#L8

It sounds like the modern TextDecoder API is able to perform this decoding without the arguments limit. I will make a PR fix.

mattrossman avatar Jul 16 '22 19:07 mattrossman