Skip to content

fix(fizarrita): bundle codec-worker for Vite production builds#4

Merged
thewtex merged 1 commit intomainfrom
fizarrita-worker
Feb 17, 2026
Merged

fix(fizarrita): bundle codec-worker for Vite production builds#4
thewtex merged 1 commit intomainfrom
fizarrita-worker

Conversation

@thewtex
Copy link
Copy Markdown
Contributor

@thewtex thewtex commented Feb 17, 2026

Vite only recognises the combined new Worker(new URL(..., import.meta.url))
pattern as a worker entry point. The previous approach stored the URL in a
variable (DEFAULT_WORKER_URL) and passed it to new Worker() separately,
causing Vite to copy codec-worker.js as a plain static asset without bundling
its ./internals/* dependencies. In production builds this left the worker's
relative imports unresolved, crashing at runtime.

Add createDefaultWorker() factory functions in get-worker.ts and set-worker.ts
that use the combined expression. Deprecate DEFAULT_WORKER_URL (kept for
backward compatibility) and export createDefaultWorker from the package.

Bump version to 1.4.0.

Vite only recognises the combined `new Worker(new URL(..., import.meta.url))`
pattern as a worker entry point. The previous approach stored the URL in a
variable (`DEFAULT_WORKER_URL`) and passed it to `new Worker()` separately,
causing Vite to copy codec-worker.js as a plain static asset without bundling
its `./internals/*` dependencies. In production builds this left the worker's
relative imports unresolved, crashing at runtime.

Add `createDefaultWorker()` factory functions in get-worker.ts and set-worker.ts
that use the combined expression. Deprecate `DEFAULT_WORKER_URL` (kept for
backward compatibility) and export `createDefaultWorker` from the package.

Bump version to 1.4.0.
@thewtex thewtex merged commit 49f0526 into main Feb 17, 2026
1 check passed
@thewtex thewtex deleted the fizarrita-worker branch February 17, 2026 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant