From cdd95a4755a79e67a229e345e26319a9671865c6 Mon Sep 17 00:00:00 2001 From: Forrest Date: Wed, 10 Apr 2024 14:00:33 -0400 Subject: [PATCH] fix(create-web-worker): allow undefined workerUrl --- .../typescript/itk-wasm/src/pipeline/create-web-worker.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/typescript/itk-wasm/src/pipeline/create-web-worker.ts b/packages/core/typescript/itk-wasm/src/pipeline/create-web-worker.ts index 1a792cf68..d0d37d126 100644 --- a/packages/core/typescript/itk-wasm/src/pipeline/create-web-worker.ts +++ b/packages/core/typescript/itk-wasm/src/pipeline/create-web-worker.ts @@ -4,18 +4,18 @@ import RunPipelineOptions from './run-pipeline-options' async function createWebWorker (pipelineWorkerUrl?: string | null, queryParams?: RunPipelineOptions['pipelineQueryParams']): Promise { const workerUrl = pipelineWorkerUrl let worker = null - if (workerUrl === null) { + if (workerUrl == null) { // Use the version built with the bundler // // Bundlers, e.g. WebPack, Vite, Rollup, see these paths at build time worker = new Worker(new URL('./web-workers/itk-wasm-pipeline.worker.js', import.meta.url), { type: 'module' }) } else { - if ((workerUrl as string).startsWith('http')) { - const response = await axios.get((workerUrl as string), { responseType: 'blob', params: queryParams }) + if (workerUrl.startsWith('http')) { + const response = await axios.get(workerUrl, { responseType: 'blob', params: queryParams }) const workerObjectUrl = URL.createObjectURL(response.data as Blob) worker = new Worker(workerObjectUrl, { type: 'module' }) } else { - worker = new Worker((workerUrl as string), { type: 'module' }) + worker = new Worker(workerUrl, { type: 'module' }) } }