Skip to content

fix: load Worker entries served over HTTP - #29

Merged
triniwiz merged 1 commit into
mainfrom
fix/worker-http-entry
Oct 19, 2026
Merged

triniwiz merged 1 commit into
mainfrom
fix/worker-http-entry

Conversation

@triniwiz

Copy link
Copy Markdown
Member

new Worker() treated every specifier as a file path and read it from disk. Under the Vite dev server, new Worker(new URL('./x.worker.ts', import.meta.url)) passes an http://127.0.0.1:5174/ns/m/... URL, which turned into an invalid Windows path:

Error: Failed to read module file: The filename, directory name, or volume label syntax is incorrect. (os error 123)
    at __resolveWorkerSource
    at new Worker

Reported in triniwiz/nativescript-canvas-starter-template#1.

Changes

  • worker_support.rs: an http(s):// specifier skips the resolve and disk read and goes to the threaded host as the worker's filename. Without the threaded host, this now throws a clear error instead of running an empty script.
  • worker_threads.rs: the worker bootstrap import()s an HTTP filename through the native module loader, so the entry's own imports resolve against its URL. The dev server already serves worker realms with HTTP vendor imports, so the worker doesn't need an import map. A failed load is queued back as a worker error (delivered as messageerror).
  • esm_http_test.rs: worker_entry_served_over_http covers a served worker entry with a relative import, and a missing entry surfacing its 404.

new Worker() resolved every specifier as a file and read it from disk, so a
dev server URL (new URL('./x.worker.ts', import.meta.url) under HMR) failed
with os error 123. HTTP entries now skip the disk read and the worker's thread
imports them through the native module loader, so the entry's own imports
resolve against the URL. A failed load is reported as a worker error.
@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a551e700-18c2-4ac6-af2b-c4672abd20b6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@triniwiz
triniwiz merged commit dbe1035 into main Oct 19, 2026
4 checks passed
@triniwiz
triniwiz deleted the fix/worker-http-entry branch October 19, 2026 04:23
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