sqlite
sqlite copied to clipboard
feat: update to sql.js 1.13.0
Updating sql.js to 1.13.0 causes errors like "LinkError: WebAssembly.instantiate(): Import https://github.com/sql-js/sql.js/issues/34 "a" "I": function import requires a callable"
Either jeep-sqlite is causing it or the sqlite package itself. Would be great to upgrade the version since sql.js 1.13.0 has many improvements.
Not sure if this is the issue as jeep-sqlite installs sql.js 1.13.0 as dependency (^1.11.0).
Not sure if this is the issue as jeep-sqlite installs sql.js 1.13.0 as dependency (^1.11.0).
I think it has something to do with how jeep-sqlite is loading the .wasm file. If you look at this issue in sql.js, incompatability between software and .wasm can cause the "I": function import requires a callable" issue.
For me the error went away to lock sql.js to version 1.12.0 in my dependencies.
For me the error went away to lock sql.js to version 1.12.0 in my dependencies.
Thank you! This wasted me an entire afternoon to hunt down. I should have checked open issues first.
I installed the latest @capacitor-community/sqlite and I kept getting the LinkError bubbled up from wasm. No amount of try catch in javascript land helped. Running the following command
npm ls @capacitor-community/sqlite jeep-sqlite sql.js
yields
└─┬ @capacitor-community/[email protected]
└─┬ [email protected]
└── [email protected]
I presume sql.js going from 1.12 to 1.13 introduced a breaking change?
For me the error went away to lock sql.js to version 1.12.0 in my dependencies.
In addition to this, after doing an npm update, I had to copy the sql-wasm.wasm file from the node modules distribution to the public\assets folder.
For me the error went away to lock sql.js to version 1.12.0 in my dependencies.
In addition to this, after doing an npm update, I had to copy the sql-wasm.wasm file from the node modules distribution to the public\assets folder.
(for others who struggled like me) In addition to these two, also change the locateFile function in the initSqlJs to (file) => "/assets/sql-wasm.wasm".
And thank you all, it now works as it should!
For me the error went away to lock sql.js to version 1.12.0 in my dependencies.
In addition to this, after doing an npm update, I had to copy the sql-wasm.wasm file from the node modules distribution to the public\assets folder.
(for others who struggled like me) In addition to these two, also change the
locateFilefunction in theinitSqlJsto(file) => "/assets/sql-wasm.wasm".And thank you all, it now works as it should!
@cxivo Where is initSqlJs?
In file.
\node_modules\sql.js\dist\sql-wasm.js
For me the error went away to lock sql.js to version 1.12.0 in my dependencies.
In addition to this, after doing an npm update, I had to copy the sql-wasm.wasm file from the node modules distribution to the public\assets folder.
(for others who struggled like me) In addition to these two, also change the
locateFilefunction in theinitSqlJsto(file) => "/assets/sql-wasm.wasm".And thank you all, it now works as it should!
@cxivo Where is initSqlJs?
Just put "cp node_modules/sql.js/dist/sql-wasm.wasm public/assets/" in your terminal if your project is react/vue