Registry / testing / comlink-fetch

comlink-fetch

JSON →
library0.1.2jsnpmunverified

Comlink Fetch is a minimal ES6 wrapper that integrates the native Fetch API with Comlink, enabling fetch calls to be offloaded to a Web Worker for improved UI performance. Current stable version: 0.1.2. Release cadence is low (single initial release). It differentiates by providing a zero-config proxy that allows fetch to be used transparently within workers, unlike manual message passing. Only supports default import, no named exports. Note: Package is experimental and no longer actively maintained.

npm install comlink-fetch
INSTALL
IMPORT
SIG · COMLINK-FETCH
C
comlink-fetch
testingjavascriptv0.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

comlinkFetch
import comlinkFetch from 'comlink-fetch'
const comlinkFetch = require('comlink-fetch')
Package is ESM-only; no CommonJS support.
default import
import comlinkFetch from 'comlink-fetch'
import { comlinkFetch } from 'comlink-fetch'
Only a default export; named export causes undefined.
TypeScript usage
import comlinkFetch from 'comlink-fetch'
import * as comlinkFetch from 'comlink-fetch'
No type definitions shipped. Use @ts-ignore or custom typings.

Shows basic usage: wrap a worker with Comlink and perform fetch inside the worker.

// main.js import { wrap } from 'comlink'; import comlinkFetch from 'comlink-fetch'; async function init() { const worker = new Worker('worker.js'); const api = wrap(worker); // comlinkFetch is used inside the worker // See worker.js below } // worker.js importScripts('https://unpkg.com/comlink@4/umd/comlink.js'); importScripts('https://unpkg.com/comlink-fetch/dist/comlink-fetch.umd.js'); const fetchWorker = { async get(url) { const response = await fetch(url); return response.json(); } }; Comlink.expose(fetchWorker);
Debug
Known issues
deprecatedPackage is no longer maintained; last publish 4 years ago.
fix
Use native fetch in workers directly (modern browsers support it) or use Comlink with explicit fetch.
affects: *
gotchaImport must be default import; named import results in undefined.
fix
Use `import comlinkFetch from 'comlink-fetch'`
affects: >=0.1
gotchaPackage only ships UMD bundle for workers; not ESM for modern bundlers.
fix
For bundler usage, consider using dynamic import or fork the package.
affects: >=0.1
breakingComlink v4 changed API; comlink-fetch may be incompatible with newer versions.
fix
Pin comlink to version 3 or use a more recent Comlink wrapper.
affects: >=0.1
Errors
Common errors & fixes
Cannot find module 'comlink-fetch'
Missing package installation.
fix
Run `npm install comlink-fetch`
Uncaught TypeError: comlinkFetch is not a function
Import using named import instead of default import.
fix
Change to `import comlinkFetch from 'comlink-fetch'`
Uncaught ReferenceError: Comlink is not defined
Comlink not loaded in worker.
fix
Add `importScripts('path/to/comlink.js')` before comlink-fetch.
Upgrade
Version history
0.1.2latest on npm
Audit
Dependencies
comlinkrequiredRequired for Web Worker RPC communication
Agent activity
10 hits · last 30 days
node
8
Amazon
1
OpenAI (training)
1
Resources
comlink-fetch — npm install comlink-fetch · libregistry