@multiplatform.one/vite-plugin-gnome
v6.7.0
Published
Vite plugin that makes Tamagui render under react-gnome (GTK4/GJS) — bundle patches for @tamagui/core's native lazy-init chains, the sheet/portal native builds, the hover/animation gates, plus the Tamagui-specific resolver aliases. Pairs with @react-gnome
Readme
@multiplatform.one/vite-plugin-gnome
Vite plugin that makes Tamagui render under
react-gnome (GTK4 / GJS /
libadwaita). Real Tamagui (@tamagui/core/native) assumes a
react-native-web-lite runtime; under GJS none of that holds, so this
package patches the bundler's view of the upstream packages instead of
reimplementing them.
Pairs with @react-gnome/vite-plugin, which carries the GENERIC
react-gnome-under-GJS settings (react-native → @react-gnome aliases,
react-native-first resolve conditions, GJS define shims, React
dedupe, the polyfills-first contract). This package carries only the
Tamagui-specific parts.
Exports
| export | what it is |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| tamaguiPlugin | per-source transform (lazy-init/StyleSheet/Platform fixes, hover + animation gates, sheet/portal native-build fixes) + post-bundle generateBundle (duplicate-init_esm$1 dedupe) |
| tamaguiAliases(options) | @tamagui/core + @tamagui/web → @tamagui/core/native, tamagui meta-package → your lean barrel, optional lucide shim (string finds) |
| tamaguiLinkedAliases(options) | same entries as exact-match regexes — for alias lists that mix in absolute-path replacements (pnpm link: consumers) |
| tamaguiPatchAnchors | every regex the patches anchor on, exported for the anchor-verification test |
Usage
import { gnomeAliases, gnomeConditions, gnomeDefine } from "@react-gnome/vite-plugin";
import { tamaguiAliases, tamaguiPlugin } from "@multiplatform.one/vite-plugin-gnome";
import { resolve } from "node:path";
export default defineConfig({
plugins: [react(), tamaguiPlugin],
resolve: {
conditions: [...gnomeConditions],
alias: [
...gnomeAliases(reactGnomePackagesDir),
...tamaguiAliases({
tamaguiBarrel: resolve(import.meta.dirname, "src/tamagui-barrel.ts"),
}),
],
},
define: gnomeDefine("production"),
});The anchor-verification test
The patches are FRAGILE BY DESIGN: each one anchors on a regex over the
@tamagui/* dist files. A Tamagui version bump that reshapes those
files makes a patch silently no-op in the build — the breakage only
surfaces as runtime failures under GJS. tests/anchors.test.ts asserts
every anchor still matches the pinned @tamagui/* devDependencies:
pnpm --filter @multiplatform.one/vite-plugin-gnome testWhen bumping Tamagui: bump the @tamagui/core / @tamagui/sheet /
@tamagui/portal devDependencies here in lockstep with the app, run
the test, and re-derive any anchor it reports as lost.
