Comments (6)
Worker modules are now in the Firefox nightly build, targeted for stable channel release in mid-February. It feels buggy at the moment, but that's just how nightlies are.
Update 1/5/23: Regressions forced reverting the worker module commit 🙁. Looks like release could slip.
from wa-sqlite.
If anyone comes here trying to put wa-sqlite
in a service worker (which as of this posting still has terrible support for modules...) and is using vite-plugin-pwa
, then you can put something like this in your VitePWAOptions
config:
import replace from "@rollup/plugin-replace";
...
injectManifest: {
...
// @ts-ignore - this is a valid option somehow... and is required for wa-sqlite to work
plugins: [replace({ "import.meta.url": mode === "development" ? "import.meta.url" : "undefined" })],
},
And at the very least, it seems to work for me. As mentioned above, an empty string probably also works.
from wa-sqlite.
To create a Web Worker and being able to use ESM add a 2nd argument with { type: 'module' }
new Worker(url, { type: 'module '})
from wa-sqlite.
You can load an ES module directly in a Worker if browser compatibility is not an issue for you, but the point of this FAQ item is that currently bundling is required to work across all WASM-capable browsers (i.e. including Firefox) and this shows a workaround for a bundling problem.
from wa-sqlite.
I know, i just wanted to help out with some faq q/a stuff for others who also wonder how to load esm stuff in workers ;)
from wa-sqlite.
As an FYI, it appears there is some activity in Firefox for module workers.
from wa-sqlite.
Related Issues (20)
- Support concurrent access to multiple databases HOT 3
- RuntimeError: memory access out of bounds - IDBBatchAtomicVFS HOT 5
- Racy IDBBatchAtomicVFS behavior when calling methods directly HOT 6
- PRAGMA synchronous=0; causes `database disk image is malformed` for `IDBBatchAtomic` VFS HOT 4
- Replace sqlite with libsql
- Corruption in vlcn fork with FTS5 HOT 8
- IDBBatchAtomicVFS error: `TypeError: Cannot read properties of null (reading 'fileSize')` HOT 4
- Strange error stack trace: both "SQL error" and "journal file not found" HOT 7
- Trigger on multiple tabs HOT 3
- Slow Query Execution for Tables with Diverse Data HOT 1
- Error: database disk image is malformed HOT 10
- Error: no such module: rtree HOT 2
- Feature request: add last_insert_rowid method
- sqlite3.exec throws "RuntimeError: memory access out of bounds" HOT 11
- Yarn install `Packing the package failed exit code 1` HOT 2
- Empty blobs as bind parameters being returned as NULLs HOT 2
- Full text support HOT 2
- Which VFS is the best?
- Call stack size exceeded of wasm asyncify HOT 7
- Example VFS locking can have name collisions across filesystems HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wa-sqlite.