How to use the @parcel/workers.default.getShared 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 / Bundler.js View on Github external
await new Promise(resolve => this.watcher.once('ready', resolve));
      }
      this.watchedGlobs.forEach(glob => {
        this.watcher.add(glob);
      });
      this.watcher.on('add', this.onAdd.bind(this));
      this.watcher.on('change', this.onChange.bind(this));
      this.watcher.on('unlink', this.onUnlink.bind(this));
    }

    if (this.options.hmr) {
      this.hmr = new HMRServer();
      this.options.hmrPort = await this.hmr.start(this.options);
    }

    this.farm = await WorkerFarm.getShared(this.options, {
      workerPath: require.resolve('./worker.js'),
    });
  }