GoogleChromeLabs / GoogleChromeLabs/comlink

Comlink setup with Webpack 5 & React

Open
#565 6 comments 12 reactions 0 assignees View on GitHub
invalid
Dominant language
TypeScript
Stars
12.8k
Forks
435
PR merge metrics
No merged PRs in 30d

Description

Anyone can provide an example of comlink setup with webpack 5?

Webpack 5 supports work with web-workers natively therefore I used the following syntax to import my worker

`const heavyCalc = new Worker(new URL('./heavyCalc.worker.js', import.meta.url));`

That works absolutely fine on local environment.

Once a run a build on my React app and deploy it I get the following error
`989.e091b9fb8db3edae7192.js:1 Uncaught TypeError: o.h is not a function`

to be more precise:
` o.u = e=>443 === e ? "443.c16ce60f72c403c299d8.js" : e + ".bundle." + o.h() + ".js",`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.