nuxt-workers

Easily run code in web workers in Nuxt.
52,258 447
Install
npm install nuxt-workers
Latest Version:0.1.0
Vue:3
License:MIT
Last Updated:Oct 19, 2026
Links: GitHub  ·  npm
Maintainer: danielroe

Nuxt Workers

npm version npm downloads Github Actions Codecov

SSR-safe, zero-config Web Workers integration for Nuxt.

Web Workers enable running JavaScript code in the background to perform complex tasks without blocking the main thread, ensuring smoother and more responsive web applications.

Read more about Web Workers.

Features

  • 🔥 SSR-safe usage of Web Workers
  • ✨ auto-imported, zero-configuration
  • 💪 fully typed

Quick Setup

Install and add nuxt-workers to your nuxt.config.

npx nuxi@latest module add nuxt-workers

That's it! You can add web workers in your Nuxt app ✨

Usage

Create your web worker in the ~/workers/ directory. It should export any utilities you want to be usable elsewhere:

// workers/hi.ts
export function hi() {
  return 'Hello from web worker!'
}

Then, call it in the rest of your Vue app.

<script setup lang="ts">
const message = await hi()
</script>

<template>
  <div>
    {{ message }}
  </div>
</template>

[!TIP] Even if your function is synchronous, it will always become async when it is called within a worker because communication with a worker will always be asynchronous.

Roadmap

  • 📖 basic documentation
  • 🧪 client-side test
  • 🧱 useNuxtWorker composable for more fine-grained control
  • ⚗️ automatic deduplicating on client-side
  • 📦 webpack support
  • ⚠️ type-level + dev warning if non serialisable args are passed
  • 🤝 automatic shared workers with .shared.ts suffix
  • 💤 worker auto-shutdown

💻 Development

  • Clone this repository
  • Enable Corepack using corepack enable
  • Install dependencies using pnpm install
  • Stub module with pnpm dev:prepare
  • Run pnpm dev to start playground in development mode

License

Made with ❤️

Published under the MIT License.

Related Packages

@nuxtjs/critters

Critical CSS for Nuxt

594,605 189
nuxt-beastcss

Fast Critical CSS for Nuxt

21,758
@docus/core-edge

The Docus core.

8,638
@docus/app-edge

The Docus default app.

8,488
@docus/app

The Docus default app.

5,187

Version History

Version Released License
0.1.0 MIT
0.0.3 MIT
0.0.2 MIT
0.0.0