Files
hanzo.sh-native/vite.config.ts
zeekayandHanzo Dev 7ca95cc63c hanzo.sh on @hanzo/ui + @hanzo/gui: no Tailwind, no shadcn, no Radix
The page was a Lovable export: Tailwind 4, 48 generated `components/ui/*` files,
27 Radix packages, and two of everything — a `Navbar` above a `Hero` that drew
its own header, a hand-written footer of `href="#"` links below the real one, and
two dead sections about a banking app that no route rendered. All of it is gone,
and none of its copy is: the install commands, the per-bundle shims, the language
packages, the bundles, the after-install lines and the "Accelerate Development
with AI" section are the same words, now rendered by the design system.

  @hanzo/products  the launcher and the whole footer index — the estate settles
                   that content once; this property declares only its own four
                   nav links and its one call-to-action
  @hanzo/ui        SiteNav, SiteFooter, BrandMark, Panel, StatusTag, ToastProvider
  @hanzo/gui       every primitive, on @hanzo/ui/gui-config — the scale the
                   console and hanzo/sites render against
  @hanzo/design    monochrome, dark by default, Geist Sans + Geist Mono SELF-HOSTED
                   (the CDN @import is gone, so the CR's CSP can be same-origin)
  @hanzo/logo      the mark, through BrandMark

Direct dependencies go from 49 to 12. Zero tailwind/shadcn/radix strings survive
in src/ or in any config, and zero reach the bundle. React Query, react-router,
sonner, cmdk, vaul, recharts, embla, react-hook-form, zod, next-themes and
lovable-tagger went with them — none was doing anything.

Also fixed, because they were in the way:

- The polyglot's `#!/bin/sh <<\EOF` preamble precedes `<!DOCTYPE html>`, so the
  parser puts it at the top of `<body>`: hanzo.sh has been rendering its own
  shebang above its header. Removed before first paint (it cannot be hidden with
  CSS and cannot move in the file).
- Shell commands were not monospace: `$mono` is not a token in gui-config, so
  `fontFamily="$mono"` resolved to nothing.
- Controls were `<div accessibilityRole="button">`, which on web is no role and no
  tab stop. `src/components/Pressable.tsx` renders a real `<button>`.
- Every destination in the header and the footer now clears 44px, via the `link`
  renderers those two components take for exactly this purpose.

Two @hanzo/[email protected] defects are routed around IN PLACE, each with its delete
condition, both documented in LLM.md: `@hanzo/ui/product` statically imports the
optional, Next-only peer `@hanzogui/next-theme` (one tsup chunk holds both theme
toggles), and `SiteNav` writes `$sm` meaning "phone" where v5 defines it as
`minWidth: 640` — inverted, so the phone got the desktop link row.

Verified: `pnpm build` exits 0, `pnpm typecheck` and `pnpm lint` clean, the
Dockerfile's three polyglot assertions hold and `bash dist/index.html --help`
still prints the installer usage. Playwright at 390x844: no horizontal scroll
(scrollWidth 390), 71 interactive elements, all >=44x44 but the inline `uv` link
in a sentence, no console errors, menu opens, copy writes the command to the
clipboard and toasts. Same at 1280x900.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-28 16:53:26 -07:00

40 lines
1.4 KiB
TypeScript

import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
const shim = (p: string) => fileURLToPath(new URL(p, import.meta.url))
/**
* @hanzo/gui is consumed at RUNTIME — the provider injects its CSS itself, and
* the optimizing compiler is an optimization, not a requirement. Same
* arrangement as hanzo/sites and the console, for the same reason.
*
* The two settings that are not optional:
* • `react-native` → `react-native-web`, because the gui primitives are
* cross-platform and resolve the native module by name on web too.
* • `.web.*` FIRST in `resolve.extensions`, which is what makes packages in the
* react-native ecosystem hand back their web variant instead of Flow source.
*/
export default defineConfig({
// Relative asset paths: the built index.html is a POLYGLOT served from the
// domain root, and a relative src survives being read as bytes anywhere.
base: './',
server: {
host: '::',
port: 8080,
},
plugins: [react()],
resolve: {
alias: {
'react-native': 'react-native-web',
// Why this exists: src/shims/hanzogui-next-theme.ts.
'@hanzogui/next-theme': shim('./src/shims/hanzogui-next-theme.ts'),
},
extensions: ['.web.tsx', '.web.ts', '.web.jsx', '.web.js', '.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json'],
},
build: {
target: 'es2022',
},
})