-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Hi,
I am trying to use sqlite-wasm-rs
as part of a Yew web worker.
This web worker, which is called dbws_worker
, is imported in Trunk using the following trunk metadata link:
<link data-trunk rel="rust" href="Cargo.toml" data-bin="dbws_worker" data-type="worker" data-bindgen-target="web" data-weak-refs
data-wasm-opt="z" />
Now, when I start the application, depending on the browser, I get a few different errors:
In Google Chrome, I get: Uncaught SyntaxError: Failed to execute 'importScripts' on 'WorkerGlobalScope': Cannot use import statement outside a module
, which is associated to the following line which gets added to the top of the web worker script:
import { JSUtils } from './snippets/sqlite-wasm-rs-56a7e97fd7d8f783/src/vfs/utils.js';
As illustrated here:

In Safari, I get SyntaxError: Unexpected token '{'. import call expects one or two arguments.
, but I don't know the line of the error so I am not certain it is related to sqlite-wasm-rs
- it is co-occurrent with when I import it though.
Finally, in Firefox I get SyntaxError: import declarations may only appear at top level of a module
, which is also referring to the same line as in Google Chrome.
The overall application looks something like this:
If needed, I can try to reduce this to a smaller test example - do let me know whether these information have already given you some ideas to try out.
Have a great day and thank you,
Luca