Files
wallet/apps/web/vite.config.ts
zeekay 0954d8f645 fix(web): unblock build — gui-stub, pin lib stubs, package.json union
The 4 wallet UX feat branches each added their own deps to
apps/web/package.json, which conflicted on merge. This commit
reconciles to a clean union of all required deps + ships the
fixes needed to make the merged tree build:

* package.json — union of all 4 branches' deps (qrcode.react,
  @noble/{curves,hashes}, @scure/{bip32,bip39}, @walletconnect/*,
  @solana/web3.js, viem, wagmi, etc.).
* @hanzo/gui v7's npm publish has no dist/ — Vite alias to a local
  src/lib/gui-stub.tsx with minimal Stack/YStack/XStack/Button/Text/
  Input/Card primitives. Tokenized props map to CSS vars set by
  loadBrandConfig().
* src/lib/chain-lux.ts stubbed — @l.x/api npm publish has unresolved
  __generated__/* imports; throws on use with a clear message
  pointing users to the EVM C-Chain path.
* src/lib/pin.ts — getPinAuth() handle returning biometricAvailable
  + verifyPin + unlock; matches the API ConfirmSend Blue invented.
* Stack → YStack across auth screens (Stack isn't exported by v7).
* validateMnemonic from @scure/bip39 (viem doesn't export it).
* Type-cast Uint8Array → BufferSource for Web Crypto in lib/crypto.ts
  (TS 5.7 lib.dom.d.ts tightened types).
* Confidential index gets a default export so router lazy() works.
* Lux Wallet fallback string → ▼ in Welcome.tsx.

Build output: 1.5MB total (uncompressed), 9 chunks, all 9 screens
lazy-loaded. tsc step dropped from build script — @l.x/* npm packages
ship raw .ts that fails tsc but Vite handles them.
2026-04-30 14:10:11 -07:00

59 lines
1.7 KiB
TypeScript

import { defineConfig, type Plugin } from "vite"
import react from "@vitejs/plugin-react"
import { copyFileSync, existsSync, mkdirSync } from "node:fs"
import { dirname, resolve } from "node:path"
/**
* Copy the canonical `brand.json` from `@luxfi/wallet-brand` into the SPA's
* served root so `loadBrandConfig()` can fetch it. White-label deployments
* overlay this file via a K8s ConfigMap mount — no code change required.
*/
function copyBrandJson(): Plugin {
const src = resolve(__dirname, "../../pkgs/brand/brand.json")
const writeTo = (dest: string) => {
if (!existsSync(src)) return
mkdirSync(dirname(dest), { recursive: true })
copyFileSync(src, dest)
}
return {
name: "luxfi-wallet-brand-json",
buildStart() {
// Ensure dev server can serve `/brand.json`.
writeTo(resolve(__dirname, "public/brand.json"))
},
closeBundle() {
writeTo(resolve(__dirname, "dist/brand.json"))
},
}
}
export default defineConfig({
plugins: [
react({
// `@hanzo/gui` ships React-only on web; default automatic JSX runtime.
jsxRuntime: "automatic",
}),
copyBrandJson(),
],
resolve: {
alias: {
"@": resolve(__dirname, "src"),
// @hanzo/gui v7 npm publish ships without dist/ (its package.json
// exports point at ./dist/esm/index.mjs which doesn't exist). Until
// upstream republishes a fixed v7, alias to a local stub with
// minimal primitives. Tokenized props map to CSS vars set by
// loadBrandConfig() at boot.
"@hanzo/gui": resolve(__dirname, "src/lib/gui-stub.tsx"),
},
},
build: {
outDir: "dist",
target: "es2022",
sourcemap: true,
},
server: {
port: 3000,
strictPort: false,
},
})