How to use the @parcel/workers.default.isWorker function in @parcel/workers

To help you get started, we’ve selected a few @parcel/workers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github parcel-bundler / parcel / packages / core / parcel-bundler / src / utils / installPackage.js View on Github external
module.exports = async function(...args) {
  // Ensure that this function is always called on the master process so we
  // don't call multiple installs in parallel.
  if (WorkerFarm.isWorker()) {
    await WorkerFarm.callMaster({
      location: __filename,
      args,
    });
    return;
  }

  queue.add(...args);
  return queue.run();
};