Load web workers in a way that Webpack 5 can bundle them
This commit is contained in:
parent
cfd5165cd8
commit
84d7d43a0d
5 changed files with 13 additions and 12 deletions
|
@ -24,9 +24,6 @@ import {
|
|||
LocalStorageCryptoStore,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
|
||||
// @ts-ignore - `.ts` is needed here to make TS happy
|
||||
import IndexedDBWorker from "../workers/indexeddb.worker.ts";
|
||||
|
||||
const localStorage = window.localStorage;
|
||||
|
||||
// just *accessing* indexedDB throws an exception in firefox with
|
||||
|
@ -55,7 +52,7 @@ export default function createMatrixClient(opts: ICreateClientOpts): MatrixClien
|
|||
indexedDB: indexedDB,
|
||||
dbName: "riot-web-sync",
|
||||
localStorage,
|
||||
workerFactory: () => new IndexedDBWorker(),
|
||||
workerFactory: () => new Worker(new URL("../workers/indexeddb.worker.ts", import.meta.url)),
|
||||
});
|
||||
} else if (localStorage) {
|
||||
storeOpts.store = new MemoryStore({ localStorage });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue