nyaaorick commited on
Commit
3c72141
·
verified ·
1 Parent(s): 00a752e

docs(roadmap): expose worker packaging defect as an independent item in section 1

Browse files
Files changed (1) hide show
  1. ROADMAP.md +11 -9
ROADMAP.md CHANGED
@@ -33,14 +33,16 @@ from the other side.
33
  - [~] **Gate A — a bare Vite page loads a prebuilt model and generates.**
34
  [examples/bare/](examples/bare/) exists and the GPU-free half is proven: `vite build` resolves
35
  through the `exports` map and splits into an entry chunk, the decode worker as its own chunk,
36
- and the 6 MB WebLLM bundle as a lazy one.
37
-
38
- **Broke on real-browser run: worker unbundled imports in production.**
39
- When deployed to a static host (Hugging Face Spaces), `engine.load()` threw
40
- `PACKAGE_INCOMPLETE`: *"The decode worker failed to load from .../assets/engine-worker-dJUbtWsb.js"*.
41
-
42
- *Root cause:* Rollup's `new Worker(new URL(..., import.meta.url), { type: "module" })` handling
43
- copies `engine-worker.js` verbatim as an asset chunk without bundling or rewriting its internal
 
 
44
  ESM imports. The emitted worker still carries:
45
  `import { WebWorkerMLCEngineHandler } from "../../vendor/web-llm.js"`
46
  `import { WORKER_CONFIGURE } from "./constants.js"`
@@ -51,7 +53,7 @@ from the other side.
51
  missed it because it asserted file *existence* (`assets.some(f => f.startsWith("engine-worker"))`),
52
  never executing the worker in a browser.
53
 
54
- *Remediation:*
55
  - [x] **Demo workaround:** Pre-bundle `engine-worker.js` with `esbuild --bundle --format=esm` into a
56
  standalone 6.58 MB file (`public/engine-worker.js`) with zero external imports, and pass explicit
57
  `workerUrl: new URL("engine-worker.js", window.location.href)`.
 
33
  - [~] **Gate A — a bare Vite page loads a prebuilt model and generates.**
34
  [examples/bare/](examples/bare/) exists and the GPU-free half is proven: `vite build` resolves
35
  through the `exports` map and splits into an entry chunk, the decode worker as its own chunk,
36
+ and the 6 MB WebLLM bundle as a lazy one. What remains is **one run in a WebGPU browser** to
37
+ confirm it generates. `npm run verify-consumer` already exercises a real install end to end,
38
+ short of the actual generation.
39
+ - [ ] **Defect: Worker unbundled relative imports in production (`vite build` / Rollup blind spot).**
40
+ First real-browser run on a static host (Hugging Face Spaces) surfaced a packaging defect
41
+ that passed all prior headless assertions. On `vite build`, `engine.load()` threw
42
+ `PACKAGE_INCOMPLETE`: *"The decode worker failed to load from .../assets/engine-worker-*.js"*.
43
+
44
+ **Root cause:** Rollup's `new Worker(new URL(..., import.meta.url), { type: "module" })`
45
+ handling copies `engine-worker.js` as an asset chunk without bundling or rewriting its internal
46
  ESM imports. The emitted worker still carries:
47
  `import { WebWorkerMLCEngineHandler } from "../../vendor/web-llm.js"`
48
  `import { WORKER_CONFIGURE } from "./constants.js"`
 
53
  missed it because it asserted file *existence* (`assets.some(f => f.startsWith("engine-worker"))`),
54
  never executing the worker in a browser.
55
 
56
+ **Resolution:**
57
  - [x] **Demo workaround:** Pre-bundle `engine-worker.js` with `esbuild --bundle --format=esm` into a
58
  standalone 6.58 MB file (`public/engine-worker.js`) with zero external imports, and pass explicit
59
  `workerUrl: new URL("engine-worker.js", window.location.href)`.