codesandbox / codesandbox/codesandbox-client
Support web workers in sandpack
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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