
Research
Malicious Go “crypto” Module Steals Passwords and Deploys Rekoobe Backdoor
An impersonated golang.org/x/crypto clone exfiltrates passwords, executes a remote shell stager, and delivers a Rekoobe backdoor on Linux.
vite-plugin-comlink
Advanced tools
This plugins requires vite >=2.8 for WebWorkers and vite >= 2.9.6 for shared worker to work properly.
Use WebWorkers with comlink.
This plugin removes the need to call expose, wrap from comlink and also you don't need to create the worker on your own.
npm i --save-dev vite-plugin-comlink # yarn add -D vite-plugin-comlink
npm i --save comlink # yarn add comlink
As you don't want to wait for a new release for this plugin when a new version of comlink is released, this plugin has comlink as a peer dependency so you can install the version of comlink that you need.
// vite.config.js
import { comlink } from 'vite-plugin-comlink'
export default {
plugins: [
comlink()
],
worker: {
plugins: [
comlink()
]
}
}
Put this plugin as one of the first plugins. Only other plugins that create ComlinkWorker or ComlinkSharedWorker or transform files based on the existence of ComlinkWorker or ComlinkSharedWorker should come before this plugin!
// worker.js
export const add = (a: number, b: number) => a + b
// main.ts
// Create Worker
const instance = new ComlinkWorker(new URL('./worker.js', import.meta.url), {/* normal Worker options*/})
const result = await instance.add(2, 3)
result === 5
// Create SharedWorker
const instance = new ComlinkSharedWorker(new URL('./worker.js', import.meta.url), {/* normal Worker options*/})
const result = await instance.add(2, 3)
result === 5
Add
/// <reference types="vite-plugin-comlink/client" />
to your vite-env.d.ts file to make sure typescript will use vite-plugin-comlink/client.
// worker.ts
export const add = (a: number, b: number) => a + b
// main.ts
// Create Worker
const instance = new ComlinkWorker<typeof import('./worker')>(new URL('./worker', import.meta.url), {/* normal Worker options*/})
const result = await instance.add(2, 3)
result === 5
// Create SharedWorker
const instance = new ComlinkSharedWorker<typeof import('./worker')>(new URL('./worker', import.meta.url), {/* normal Worker options*/})
const result = await instance.add(2, 3)
result === 5
Not all Browsers support module Workers (see https://caniuse.com/mdn-api_worker_worker_ecmascript_modules).
This results in some drawbacks for fastest and best support:
For fast development we use module Workers as bundling the complete worker on the fly is not performant.
In default settings we bundle the whole worker at build to a single file. Therefore all browsers that support Workers, work in production.
This is the same behavior as vite and it is NOT CHANGEABLE!
If you want a worker to be a module worker in production, add type: 'module' to the worker constructor options.
worker.plugins array.https://github.com/GoogleChromeLabs/comlink
https://github.com/surma/rollup-plugin-comlink
FAQs
Comlink for Vite
The npm package vite-plugin-comlink receives a total of 22,513 weekly downloads. As such, vite-plugin-comlink popularity was classified as popular.
We found that vite-plugin-comlink demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
An impersonated golang.org/x/crypto clone exfiltrates passwords, executes a remote shell stager, and delivers a Rekoobe backdoor on Linux.

Security News
npm rolls out a package release cooldown and scalable trusted publishing updates as ecosystem adoption of install safeguards grows.

Security News
AI agents are writing more code than ever, and that's creating new supply chain risks. Feross joins the Risky Business Podcast to break down what that means for open source security.