File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
public/jsonic-bench/src/adapters Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -20,11 +20,18 @@ export class SQLJSAdapter extends DatabaseAdapter {
2020 }
2121
2222 async init ( ) {
23- // Load real SQL.js WASM library from CDN
24- const module = await import ( 'https://cdn.jsdelivr.net/npm/[email protected] /dist/sql-wasm.js' ) ; 25- // Handle both ESM default export and UMD format
26- const initSqlJs = module . default || module ;
27- const SQL = await initSqlJs ( {
23+ // Load real SQL.js WASM library using script tag approach (more reliable for UMD modules)
24+ if ( ! window . initSqlJs ) {
25+ await new Promise ( ( resolve , reject ) => {
26+ const script = document . createElement ( 'script' ) ;
27+ script . src = 'https://cdn.jsdelivr.net/npm/[email protected] /dist/sql-wasm.js' ; 28+ script . onload = resolve ;
29+ script . onerror = reject ;
30+ document . head . appendChild ( script ) ;
31+ } ) ;
32+ }
33+
34+ const SQL = await window . initSqlJs ( {
2835 locateFile :
file => `https://cdn.jsdelivr.net/npm/[email protected] /dist/${ file } ` 2936 } ) ;
3037
You can’t perform that action at this time.
0 commit comments