Skip to content

Conversation

@tomayac
Copy link
Collaborator

@tomayac tomayac commented Feb 7, 2025

I'm trying to release v3.49.0, but it fails:

sqlite3-worker1-bundler-friendly.mjs:44 Uncaught TypeError: Failed to execute 'importScripts' on 'WorkerGlobalScope': Module scripts don't support importScripts().

This diff is the problem, @sgbeal.

@sgbeal
Copy link
Collaborator

sgbeal commented Feb 7, 2025

i don't fully understand this one: one of our test scripts recently stopped working with the same error and i disabled it because that test had always worked in the past and i assumed that the browsers had simply decided that it no longer works that way. i will look into this ASAP and hope to have a resolution for you today.

@tomayac
Copy link
Collaborator Author

tomayac commented Feb 7, 2025

@sgbeal
Copy link
Collaborator

sgbeal commented Feb 7, 2025

This turns out to be a build problem - accessing makefile vars before an imported file sets them. i'll have a fix to you shortly.

@sgbeal
Copy link
Collaborator

sgbeal commented Feb 7, 2025

My sincere apologies for this hiccup. The current tip of the 3.49 branch has the fix for this (bug introduced via build refactoring): https://sqlite.org/src/timeline?r=branch-3.49

@tomayac tomayac marked this pull request as ready for review February 11, 2025 23:25
@tomayac tomayac merged commit 302a2a9 into main Feb 11, 2025
@tomayac tomayac deleted the v3.49.0 branch February 11, 2025 23:25
@tomayac
Copy link
Collaborator Author

tomayac commented Feb 11, 2025

FYI @sgbeal, I've manually patched sqlite3-worker1-bundler-friendly.mjs (25dec31) so the import works and released this as v3.49.0-build1.

@sgbeal
Copy link
Collaborator

sgbeal commented Feb 11, 2025

Thank you for that. It turns out that that problem also hit us a few versions ago for the same reason - build refactoring changed the order of makefile var decls and use. The build rules now check for this bug so they'll break loudly if i make that mistake again.

@steida
Copy link

steida commented Feb 12, 2025

@tomayac Hi, the patch seems not to work for me. I just updated to 3.49.0-build1

hook.js:608 ../../node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-worker1-bundler-friendly.mjs
The generated code contains 'async/await' because this module is using "topLevelAwait".
However, your target environment does not appear to support 'async/await'.
As a result, the code may not run as expected or may cause runtime errors.

@tomayac
Copy link
Collaborator Author

tomayac commented Feb 12, 2025

Duh, of course top-level await was going to bite us. Just released build2, which uses an IIFE. Hope this works until the fix comes in from upstream.

@sgbeal
Copy link
Collaborator

sgbeal commented Feb 12, 2025

If you'd like to patch it now, that file's whole content, minus the docs, is:

import {default as sqlite3InitModule} from './sqlite3-bundler-friendly.mjs';
sqlite3InitModule().then(sqlite3 => sqlite3.initWorker1API());

We will probably be doing a 3.49.1 patch release late this week or early next, primarily for build-related tweaks, and this fix is in that version.

@tomayac
Copy link
Collaborator Author

tomayac commented Feb 12, 2025

Ah, nice. Published as build3 then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants