You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WASM packages must be excluded from Vite's dev server [dependency pre-bundling](https://github.com/vitejs/vite/discussions/9256). This only affects the dev server. Production builds use Rollup instead of esbuild and handle WASM files correctly.
// Silently ignore init errors - they'll be thrown when APIs are used
25
-
});
26
-
}
27
-
28
-
// Start init on module load
29
-
startInit();
30
-
31
19
/** Get initialized WASM module or throw */
32
20
exportfunctiongetWasmModule(): WasmModule{
33
21
if(wasmModule){
34
22
returnwasmModule;
35
23
}
36
24
thrownewWasmInitError(
37
-
'WASM module not yet initialized. Use the async import or wait for module to load: import("@guanmingchiu/sqlparser-ts").then(({ parse }) => parse(sql))'
25
+
'WASM module not yet initialized. Call `await init()` before using the parser.'
38
26
);
39
27
}
40
28
41
29
/**
42
-
* Wait for WASM module to be ready
43
-
*/
44
-
exportasyncfunctionready(): Promise<void>{
45
-
startInit();
46
-
awaitinitPromise;
47
-
}
48
-
49
-
/**
50
-
* Initialize the WASM module explicitly.
51
-
* Usually not needed - the module auto-initializes on first use.
30
+
* Initialize the WASM module. Must be called before using any parser functions.
31
+
* Safe to call multiple times, subsequent calls are no-ops.
0 commit comments