function createWorkerBundle(workerFile, workerBundleFile) {
  return new Promise(function (resolve, reject) {
    var config = {
      // target: 'node', // makes the worker working for node.js
      entry: workerFile,
      output: {
        filename: workerBundleFile,
        path: __dirname
      },
      resolve: {
        fallback: {
          "os": false,
          "child_process": false,
          "worker_threads": false
        }
      },
      mode: 'production'
    };

    webpack(config).run(function (err, stats) {
      if (err) {
        console.log(err);
      }

      process.stdout.write(stats.toString() + '\n');

      if (stats.hasErrors()) {
        reject(new Error('Webpack errors:\n' + stats.toJson().errors.join('\n')));
      }

      resolve();
    });
  });
}
Generate a bundle of the worker code using Webpack
@param {string} workerFile        For example 'worker.js'
@param {string} workerBundleFile  For example 'dist/worker.bundle.js'