diff --git a/src/compiler/bundle/worker-plugin.ts b/src/compiler/bundle/worker-plugin.ts index a33bcc3ef31..62321a938fe 100644 --- a/src/compiler/bundle/worker-plugin.ts +++ b/src/compiler/bundle/worker-plugin.ts @@ -201,7 +201,10 @@ const workerMsgId = '${workerMsgId}'; const workerMsgCallbackId = workerMsgId + '.cb'; const getTransferables = (value) => { if (!!value) { - if (value instanceof ArrayBuffer) { + if (value instanceof ArrayBuffer + || value instanceof MessagePort + || value instanceof ImageBitmap + || value instanceof OffscreenCanvas) { return [value]; } if (value.constructor === Object) { @@ -345,7 +348,10 @@ export const createWorkerProxy = (worker, workerMsgId, exportedMethod) => ( const postMessage = (w) => ( w.postMessage( [workerMsgId, pendingId, exportedMethod, args], - args.filter(a => a instanceof ArrayBuffer) + args.filter(a => a instanceof ArrayBuffer + || a instanceof MessagePort + || a instanceof ImageBitmap + || a instanceof OffscreenCanvas) ) ); if (worker.then) {