Files
desktop/apps/hanzo-desktop/vite.config.ts
zeekayandHanzo Dev 35cdb82a85 refactor(wallet): @luxwallet/store rewire + drop @hanzo/ui-shadcn (1.1.41)
Point the desktop wallet stack at the canonical published @luxwallet/store (replaces the file-linked @luxwallet/core): import swaps in store/keychain, and inline the SIWx (CAIP-122/EIP-191) flow + web3 session store, which the store package deliberately does not ship (SIWx lives in @luxwallet/connect).

Drop the @hanzo/ui-shadcn alias entirely: its @hookform/resolvers@^3.3.2 peer conflicted with the root ^5.4.0, the ERESOLVE that hard-failed the mac release leg's npm ci. Vendor the two consumed subpaths (network switcher + wallet menu, 7 symbols) into libs/hanzo-ui/src/{network,wallet}, repoint the 5 consumers, and follow with the Tailwind @source globs.

Regenerate package-lock.json so every @luxwallet/* resolves from the npm registry — the committed lock's file:../../luxwallet/* links could never install on a CI runner.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-09 14:54:24 -07:00

103 lines
3.0 KiB
TypeScript

import { resolve } from 'path';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import wasm from 'vite-plugin-wasm';
import tsconfigPaths from 'vite-tsconfig-paths';
import tailwindcss from '@tailwindcss/vite';
// https://vitejs.dev/config/
export default defineConfig(() => ({
resolve: {
// @hanzo/usage ships its own react devDep; force a single React instance
// so its useUsage hook shares the app's React runtime. Dedupe the wallet
// store's peer deps (zustand/ethers) + @luxfi/crypto to the app's copy so
// the wallet store is one instance, not two.
dedupe: ['react', 'react-dom', 'zustand', 'ethers', '@luxfi/crypto'],
alias: {
// libsodium-wrappers-sumo ESM entry imports ./libsodium-sumo.mjs which
// lives in the separate libsodium-sumo package
'./libsodium-sumo.mjs': resolve(
__dirname,
'../../node_modules/libsodium-sumo/dist/modules-sumo-esm/libsodium-sumo.mjs',
),
},
},
plugins: [
react(),
tailwindcss(),
tsconfigPaths({ root: '../..' }),
wasm(),
],
esbuild: {
// Important for wasm plugin
supported: {
'top-level-await': true,
bigint: true,
},
},
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
//
// 1. prevent vite from obscuring rust errors
clearScreen: false,
// 2. tauri expects a fixed port, fail if that port is not available
server: {
port: 1421,
strictPort: true,
watch: {
// Exclude output.wav from being watched
ignored: ['**/output.wav'],
},
// headers: {
// 'Cross-Origin-Embedder-Policy': 'require-corp',
// 'Cross-Origin-Opener-Policy': 'cross-origin',
// },
},
// 3. to make use of `TAURI_DEBUG` and other env variables
// https://tauri.studio/v1/api/config#buildconfig.beforedevcommand
// to access the Tauri environment variables set by the CLI with information about the current target
envPrefix: [
'VITE_',
'TAURI_PLATFORM',
'TAURI_ARCH',
'TAURI_FAMILY',
'TAURI_PLATFORM_VERSION',
'TAURI_PLATFORM_TYPE',
'TAURI_DEBUG',
],
build: {
rollupOptions: {
input: {
index: resolve(__dirname, 'index.html'),
hanzo_node_manager: resolve(
__dirname,
'src/windows/hanzo-node-manager/index.html',
),
spotlight: resolve(__dirname, 'src/windows/spotlight/index.html'),
coordinator: resolve(__dirname, 'src/windows/coordinator/index.html'),
hanzo_artifacts: resolve(
__dirname,
'src/windows/hanzo-artifacts/index.html',
),
},
},
},
test: {
watch: false,
setupFiles: './src/test-setup.ts',
globals: true,
cache: { dir: '../../node_modules/.vitest/apps/hanzo-desktop' },
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
coverage: {
reportsDirectory: '../../coverage/libs/hanzo-message-ts',
provider: 'v8',
},
},
worker: {
format: 'es' as const,
},
}));