Webworker in ionic react

short: I couldn’t self.importScripts('myclass.js') in a webworker.

simple webworkers where one have an extra file that is saved for example in the asset folder and loaded to a webworker during execution, like in the following code, are working just fine.

var worker = new Worker('doWork.js');

worker.addEventListener('message', function(e) {
  console.log('Worker said: ', e.data);
}, false);

worker.postMessage('Hello World'); 

The same goes with “inline” webworkers, where you put your code in a blob and the blob is than loaded by a worker (like described here: https://www.html5rocks.com/de/tutorials/workers/basics/)

What I couldn’t figure out was importint external scripts with importScripts. For example I want to spawn a web worker with new Worker('doWork.js') and inside doWork.js I want to use self.importScripts('myclass.js'). But I couldn’t manage to do this.

If needed I can create a little sample app and publish it on github.