3 ms·
Yes, 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.creat
by kbumsik 7y ago
Yes, 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.