Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workerize-loader with Parcel bundler #109

Closed
ezekielaquino opened this issue Aug 28, 2020 · 1 comment
Closed

workerize-loader with Parcel bundler #109

ezekielaquino opened this issue Aug 28, 2020 · 1 comment
Labels

Comments

@ezekielaquino
Copy link

@ezekielaquino ezekielaquino commented Aug 28, 2020

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!

@developit
Copy link
Owner

@developit developit commented Jan 9, 2021

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);
@developit developit closed this Jan 9, 2021
@developit developit added the question label Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.