3 ms·
I did a thing where I used data URIs instead of explicit files to load up web workers. Don't know if that still works, as this was a few years ago, but it defin
by moron4hire 7y ago
I did a thing where I used data URIs instead of explicit files to load up web workers. Don't know if that still works, as this was a few years ago, but it definitely helped a lot with those sorts of issues at the time.
- kbumsik 7y agoYes, it is still one way to workaround the problem. For those who don't know: function workerFn() { ...Do worker stuff } let worker = new Worker(URL.createObjectURL(new Blob(['('+workerFn.toString()+')()']))); Though this hack works but it still have problems to be addressed: 1. It still does not resolve import/require(). This introduces another hack that dumping output of a bundler to workerFn. 2. It will make it much harder to debug since you create worker out of data, not source code.