@cyclone-ui/vite

中文文档
0.0.36发布于 2026/11/11TypeScriptES Module构建来源已验证近 30 天下载 5975

A Vite plugin that sets up Tamagui and Cyclone UI components in Vite applications.

原始使用文档
文档目录6 节
  1. Quick Features
  2. Installing
  3. Usage
  4. Options
  5. Custom design tokens
  6. Development

Cyclone UI - Vite Plugin

A Vite plugin that sets up Tamagui and Cyclone UI components in a Vite application. It wraps @tamagui/vite-plugin with the Cyclone UI defaults.

Quick Features

  • Aliases react-native to react-native-web and resolves .web.* files first
  • Pre-bundles and dedupes the Tamagui packages that share React contexts
  • Runs the Tamagui optimizing compiler with the Cyclone UI config from @cyclone-ui/tokens, or one built from your own design tokens
  • Defines process.env.TAMAGUI_TARGET, which Cyclone components read to render web-only styles

Installing

Using pnpm:

pnpm add -D @cyclone-ui/vite
pnpm add @cyclone-ui/state @cyclone-ui/tokens @tamagui/core jotai react-native-web

The plugin is ESM only, so the project's package.json needs "type": "module" (or a vite.config.mts file).

Usage

Add the plugin to vite.config.ts:

import { cycloneUI } from "@cyclone-ui/vite";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [react(), cycloneUI()]
});

Then wrap the app in the Cyclone theme provider:

import { ThemeProvider } from "@cyclone-ui/state/theme";
import { config } from "@cyclone-ui/tokens/tamagui";

createRoot(document.getElementById("root")!).render(
  <ThemeProvider config={config} disableInjectCSS={false}>
    <App />
  </ThemeProvider>
);

Options

cycloneUI() accepts every @tamagui/vite-plugin option. The defaults are:

OptionDefault
config"@cyclone-ui/tokens/tamagui"
components["@tamagui/core"]

Pass disableExtraction: true to keep styles at runtime (for example while debugging). A tamagui.build.ts file in the project root overrides these options.

Custom design tokens

Pass tokens to build the Tamagui config from your own design tokens instead of the Cyclone UI defaults. Use a DTCG token object, or token file paths or globs relative to the Vite root:

export default defineConfig({
  plugins: [react(), cycloneUI({ tokens: "tokens/**/*.json" })]
});

Files with a theme name (light.tokens.json, dark.tokens.json, …) become the light and dark themes. The tokens go through the same preprocessor and generator as @cyclone-ui/tokens, and a razorwind.config.ts in the project still applies (for example its fonts).

The config is written to .cyclone-ui/tamagui.config.ts (add .cyclone-ui to .gitignore) when Vite starts, and replaces @cyclone-ui/tokens/tamagui for the compiler and every import, so the ThemeProvider setup above stays the same. Restart Vite after changing the tokens.

Development

pnpm nx run vite:build

版本与发布记录

@cyclone-ui/vite 共发布 36 个版本,首次发布于 2026/10/24;过去 12 个月发布了 36 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.0.36latest2026/11/11今天
0.0.352026/11/10今天
0.0.342026/11/091 天前
0.0.332026/11/092 天前
0.0.322026/11/092 天前
0.0.312026/11/092 天前

关于 @cyclone-ui/vite 的常见问题

@cyclone-ui/vite 是什么?

A Vite plugin that sets up Tamagui and Cyclone UI components in Vite applications.

如何安装 @cyclone-ui/vite?

在项目目录运行 npm install @cyclone-ui/vite,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:vite(^8.3.6)、react-native-web(0.19.12)、@cyclone-ui/tokens(0.3.54)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@cyclone-ui/vite 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@cyclone-ui/vite 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@cyclone-ui/vite 可以商用吗?

@cyclone-ui/vite 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@cyclone-ui/vite 的下载量有多少?

根据 npm 官方下载统计,@cyclone-ui/vite 在 2026/10/11 – 2026/11/09 这 30 天内被下载 5,975 次,日均约 199 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cyclone-ui/vite 还在维护吗?

最新版本 0.0.36 发布于 2026/11/11(今天);至今共发布 36 个版本,其中过去 12 个月发布了 36 个;首次发布于 2026/10/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。