codesandbox / codesandbox/codesandbox-client

Support web workers in sandpack

Open
#5,877 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

✨ Feature 🎒 Bundler
Dominant language
JavaScript
Stars
13.6k
Forks
2.4k
Avg merge
6d 19h
Merged PRs (30d)
2

Description

🌈 Feature

Web workers should get transpiled and bundled like all other code.

Replace web workers url with a blob url that contains the compiled code and some prelude for communicating with the main sandpack instance to get transpiled code and handle async imports.

Related sandbox that should work: https://codesandbox.io/s/try-to-use-simple-webworker-les6y

index.js

new Worker("./worker.js");

worker.js

console.log("Hello from the worker");

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the related sandbox and its index.js and worker.js examples to understand the expected Worker usage. Trace how Sandpack currently handles URLs and compiled code; done means the worker code is transpiled and bundled, launched through the described blob URL, and supports communication with the main Sandpack instance and async imports.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.