import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import { resolve } from 'node:path'; // `@shade/widgets` re-exports from `@shade/sdk`, which transitively imports // `@shade/storage-sqlite` (and therefore `bun:sqlite`). Vite externalizes // `bun:sqlite` for browser builds, but the `import { Database } from // 'bun:sqlite'` named-import then fails to resolve. Alias the module to an // in-tree stub — the dashboard never executes the storage code path // (it talks to the prekey server via `Shade.send` / `fetch`), so the stub // is never reached at runtime. export default defineConfig({ plugins: [react()], base: '/dashboard/', resolve: { alias: { 'bun:sqlite': resolve(__dirname, 'src/stubs/bun-sqlite.ts'), }, }, build: { outDir: 'dist', emptyOutDir: true, target: 'es2022', }, });