ampproject / ampproject/worker-dom

Possiblity to use this with Webpack@5.x worker loading?

Open
#1,031 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.3k
Forks
154
PR merge metrics
No merged PRs in 30d

Description

I'm wondering if there's any way to use this package without needing to assign our worker file to a `

` to be "upgraded."

The problem is that our worker thread is being bundled via Webpack at the same time as the rest of our application and the output page is created using an HTML template. I'm not sure how it would be possible to assign the worker scripts to a div in this setup. Is there any way we can use the library in conjunction with the way Webpack bundles workers?

For reference, our code for creating our worker threads right now looks like this:

```js
new Worker(new URL('./heavyLifterWorker', import.meta.url), {
name: 'heavyLifter',
}),
```

and then Webpack is automatically bundling the worker chunk and injecting it into the page without any input from us. Is there any way to leverage Worker-DOM together with the built-in Webpack worker loading functionality?

Contributor guide

Open the contributing guide

Research direction

Start by reading the Worker-DOM setup instructions and the package entry points for upgrading worker scripts, then compare them with the Webpack 5 worker construction shown in the issue. The issue does not name relevant files or tests, and has had no reply for years. Done would mean establishing whether built-in Webpack worker loading can be used without assigning the worker file to a div, and documenting or supporting a workable path.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.