workerize-loader with Parcel bundler #109
Closed
Labels
Comments
|
Parcel supports Worker natively: // index.js
import Comlink from 'comlink';
const worker = Comlink.wrap(new Worker('./worker.js'));
worker.foo().then(console.log);// worker.js
import Comlink from 'comlink';
async function foo() {
return 42;
}
Comlink.expose({ foo });You can expose a whole module like this: // worker.js
import Comlink from 'comlink';
import * as funcs from './my-worker-code';
Comlink.expose(funcs); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does anyone know how to get this to play along with parcel?
tried everything in the documentation, no dice– it always tries to resolve
workerize-loader!as a package. any tips to the right direction much appreciated :) thanks in advance!The text was updated successfully, but these errors were encountered: