Create a plugin that provides a simple API for using web workers from your application code.
Typically, web worker scripts will be generated in a separate build, or minimally by defining a separate entry-point. This can prove cumbersome, especially since there's boilerplate to setup for message passing, and lots of associated build config to get right.
This plugin will alleviate these issues by fulfilling the following requirements:
const worker = new Worker("./path/to/worker.bundle.js");
module.exports = onMessage => {
worker.addEventListener("message", onMessage);
return msg => { worker.postMessage(msg); };
};