File tree Expand file tree Collapse file tree 3 files changed +31
-2
lines changed
packages/core/typescript/itk-wasm/src Expand file tree Collapse file tree 3 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,35 @@ function typescriptBindings(
129129 path . join ( distPipelinesDir , `${ path . basename ( prefix ) } .js` )
130130 )
131131
132+ // Check for and copy threaded WASM files if present
133+ const wasmBinaryNameWithoutFirstDir = wasmBinaryName
134+ . split ( path . sep )
135+ . slice ( 1 )
136+ . join ( path . sep )
137+ const threadsWasmPath = path . join (
138+ 'emscripten-threads-build' ,
139+ wasmBinaryNameWithoutFirstDir
140+ )
141+ const threadsThreadsWasmPath =
142+ threadsWasmPath . substring ( 0 , threadsWasmPath . length - 5 ) +
143+ '.threads.wasm.zst'
144+ const jsThreadsWasmPath =
145+ threadsWasmPath . substring ( 0 , threadsWasmPath . length - 5 ) + '.js'
146+ if ( fs . existsSync ( threadsThreadsWasmPath ) ) {
147+ fs . copyFileSync (
148+ threadsThreadsWasmPath ,
149+ path . join ( distPipelinesDir , path . basename ( threadsThreadsWasmPath ) )
150+ )
151+ const jsThreadsWasmBasename = path . basename ( jsThreadsWasmPath )
152+ const jsThreadsWasm =
153+ jsThreadsWasmBasename . substring ( 0 , jsThreadsWasmBasename . length - 3 ) +
154+ '.threads.js'
155+ fs . copyFileSync (
156+ jsThreadsWasmPath ,
157+ path . join ( distPipelinesDir , jsThreadsWasm )
158+ )
159+ }
160+
132161 const { interfaceJson, parsedPath } = wasmBinaryInterfaceJson (
133162 outputDir ,
134163 buildDir ,
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ async function loadEmscriptenModuleMainThread(
8484 }
8585
8686 const wasmBinary = decompressedArray . buffer
87- const fullModulePath = `${ modulePrefix } .js`
87+ const fullModulePath = `${ modulePrefix } .threads. js`
8888 const result = await import (
8989 /* webpackIgnore: true */ /* @vite -ignore */ fullModulePath
9090 )
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ async function loadEmscriptenModuleWebWorker(
8585 }
8686
8787 const wasmBinary = decompressedArray . buffer
88- const modulePath = `${ modulePrefix } .js`
88+ const modulePath = `${ modulePrefix } .threads. js`
8989 const result = await import (
9090 /* webpackIgnore: true */ /* @vite -ignore */ modulePath
9191 )
You can’t perform that action at this time.
0 commit comments