vite.config.mobile.ts

1.2 KB · raw

1import { defineConfig } from "vite";2import solid from "vite-plugin-solid";3import { copyFileSync, mkdirSync } from "fs";4import { resolve } from "path";56const copyPdfJsWorker = {7  name: "copy-pdfjs-worker",8  closeBundle() {9    mkdirSync("dist-mobile", { recursive: true });10    copyFileSync(11      resolve("node_modules/pdfjs-dist/build/pdf.worker.min.mjs"),12      resolve("dist-mobile", "pdf.worker.min.mjs"),13    );14  },15};1617export default defineConfig({18  plugins: [solid(), copyPdfJsWorker],19  base: "./",20  define: {21    __BUILD_TIME__: JSON.stringify(22      new Date().toLocaleTimeString([], {23        hour: "2-digit",24        minute: "2-digit",25        second: "2-digit",26      })27    ),28    __VERSION__: JSON.stringify(process.env.npm_package_version ?? "0.0.0"),29    // passkey.ts references this at module init via PASSKEY_CREATE_E2E_BYPASS.30    // Must be replaced at build time or the popup boot throws ReferenceError31    // and every sendMessage on Android sits in the shim queue forever.32    __PEACH_E2E_PASSKEYS__: JSON.stringify(false),33  },34  build: {35    outDir: "dist-mobile",36    emptyOutDir: false,37    target: "esnext",38    rollupOptions: {39      input: "src/popup/index.html",40    },41  },42});