Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Add warning about potentially-missing no-bundler feature #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/workerHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ waitForMsgType(self, 'wasm_bindgen_worker_init').then(async data => {
// OTOH, even though it can't be inlined, it should be still reasonably
// cheap since the requested file is already in cache (it was loaded by
// the main thread).
const pkg = await import('../../..');
const pkg = await import('../../..').catch(e => {
console.warn("Are you using a bundler? If not, you should use the `no-bundler` feature to fix this error, as explained in the wasm-bindgen-rayon readme.");
throw new Error(e);
});
await pkg.default(data.module, data.memory);
postMessage({ type: 'wasm_bindgen_worker_ready' });
pkg.wbg_rayon_start_worker(data.receiver);
Expand Down