https://github.com/ducaale/workers-wasm-rollup-experiment
https://github.com/ducaale/workers-wasm-rollup-experiment
Last synced: 26 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ducaale/workers-wasm-rollup-experiment
- Owner: ducaale
- Created: 2022-06-19T22:24:46.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-30T22:24:02.000Z (about 4 years ago)
- Last Synced: 2026-02-10T19:14:20.680Z (5 months ago)
- Language: JavaScript
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Workers + WASM + Rollup Experiment
Is it possible to use worker + WASM in a library that targets both browsers and node? This repo
is a proof of concept of how that could be done.
This work is built on top of the method proposed in this [article](https://justinribeiro.com/chronicle/2020/07/17/building-module-web-workers-for-cross-browser-compatibility-with-rollup/)
and uses [comlink](https://github.com/GoogleChromeLabs/comlink) to bridge the gap between
node's worker-threads and web-workers.
## Running the examples
First, make sure to [install emscripten](https://emscripten.org/docs/getting_started/downloads.html)
and then build the project:
```
npm install
npm run build
```
Once that is done, you can run the project in either Node or the Browser:
* Node: `npm run start:node`
* Web: `npm run start:web` and navigate to http://127.0.0.1:8080/examples/