File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed
Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -36,22 +36,25 @@ function isSameConfig(a, b) {
3636}
3737
3838export function generateWasmConfig ( config ) {
39- return {
40- locateFile : ( fileName ) => {
39+ if ( WASM_FILE_OBJECT ) {
40+ config . locateFile = ( fileName ) => {
4141 if ( WASM_FILE_OBJECT && fileName == WASM_FILE_OBJECT . name ) {
4242 return URL . createObjectURL ( WASM_FILE_OBJECT ) ;
4343 }
4444 return new URL ( fileName , import . meta. url ) . href ;
45- } ,
46- onRuntimeInitialized : ( module ) => {
47- if ( WASM_FILE_OBJECT ) {
48- URL . revokeObjectURL ( WASM_FILE_OBJECT ) ;
49- }
50- } ,
51- preRun : config ?. rendering === "webgpu" ? [ ( module ) => {
45+ } ;
46+ config . onRuntimeInitialized = ( ) => {
47+ // Free the object URL after runtime is initialized
48+ URL . revokeObjectURL ( WASM_FILE_OBJECT ) ;
49+ WASM_FILE_OBJECT = null ;
50+ } ;
51+ }
52+ if ( config ?. rendering === "webgpu" ) {
53+ config . preRun = [ ( module ) => {
5254 module . ENV . VTK_GRAPHICS_BACKEND = "WEBGPU" ;
53- } ] : [ ] ,
55+ } ] ;
5456 }
57+ return config ;
5558}
5659
5760/**
You can’t perform that action at this time.
0 commit comments