forked from jsnbuchanan/crowd-funder-for-time-pwa
- Update worker format to ESM in Vite config to fix IIFE format error - Increase PWA precache file size limit to 10MB to accommodate SQL.js files - Fix type declarations for worker configuration - Add proper type annotations for Vite config - Add type declarations for absurd-sql module
24 lines
634 B
TypeScript
24 lines
634 B
TypeScript
// @ts-ignore
|
|
import { initBackend } from "absurd-sql/dist/indexeddb-main-thread";
|
|
import { initializeApp } from "./main.common";
|
|
import "./registerServiceWorker"; // Web PWA support
|
|
|
|
const app = initializeApp();
|
|
|
|
function sqlInit() {
|
|
// see https://github.com/jlongster/absurd-sql
|
|
const worker = new Worker(
|
|
new URL("./registerSQLWorker.js", import.meta.url),
|
|
{
|
|
type: "module",
|
|
},
|
|
);
|
|
// This is only required because Safari doesn't support nested
|
|
// workers. This installs a handler that will proxy creating web
|
|
// workers through the main thread
|
|
initBackend(worker);
|
|
}
|
|
sqlInit();
|
|
|
|
app.mount("#app");
|