jantimon / jantimon/remote-web-worker

Support Web Workers with `type: module`

Open
#1 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
24
Forks
1
PR merge metrics
No merged PRs in 30d

Description

What do you think to also support `type: modules` workers by introducing a [workaround](https://github.com/mozilla/pdf.js/blob/e78575e5933f494dc87edf27cbff7a4c2391236a/src/display/api.js#L1985-L1994) like in `pdf.js`?
```js
const workerUrl = URL.createObjectURL(new Blob([`await import("${originalWorkerUrl}");`], {type: 'text/javascript'}))
```
We can check Worker constructor's `options` parameter and choose a proper workaround depending on the value of `type` option.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start from the Worker constructor options and the workaround referenced in the issue, then compare the pdf.js example at the linked api.js location. Determine how module-worker options should select the workaround, and verify that both module and non-module workers continue to load correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.