@arco-plugins/vite-react

中文文档
1.3.3发布于 2022/12/13MITTypeScriptCommonJS近 30 天下载 2901

For Vite build, load Arco Design styles on demand

原始使用文档
文档目录4 节
  1. Feature
  2. Install
  3. Usage
  4. Options

@arco-plugins/vite-react

Feature

  1. Style lazy load
  2. Theme import
  3. Icon replacement

Style lazy load doesn't work during development for better experience.

Install

npm i @arco-plugins/vite-react -D

Usage

// vite.config.js

import vitePluginForArco from '@arco-plugins/vite-react'

export default {
  ...
  plugins: [
    vitePluginForArco(options),
  ],
}
// react
import { Button } from '@arco-design/web-react';

export default () => (
  <div>
    <Button type="secondary">Cancel</Button>
    <Button type="primary">Submit</Button>
  </div>
);

Options

The plugin supports the following parameters:

ParamsTypeDefault ValueDescription
theme{String}''Theme package name
iconBox{String}''Icon library package name
modifyVars{Object}{}Less variables
style{'css'|Boolean}trueStyle import method
varsInjectScope{(string|RegExp)[]}[]Scope of injection of less variables (modifyVars and the theme package's variables)

**Style import methods **

style: true will import less file

import '@arco-design/web-react/Affix/style';

style: 'css' will import css file

import '@arco-design/web-react/Affix/style/css';

style: false will not import any style file

版本与发布记录

@arco-plugins/vite-react 共发布 13 个版本,首次发布于 2021/12/21;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.3.3latest2022/12/133 年前
1.3.22022/09/304 年前
1.3.12022/07/224 年前
1.3.02022/06/224 年前
1.2.02022/06/134 年前
1.1.02022/04/084 年前

关于 @arco-plugins/vite-react 的常见问题

@arco-plugins/vite-react 是什么?

For Vite build, load Arco Design styles on demand

如何安装 @arco-plugins/vite-react?

在项目目录运行 npm install @arco-plugins/vite-react,或使用 pnpm add / yarn add / bun add。

@arco-plugins/vite-react 支持 TypeScript 吗?

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

@arco-plugins/vite-react 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@arco-plugins/vite-react 可以商用吗?

@arco-plugins/vite-react 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@arco-plugins/vite-react 的下载量有多少?

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

@arco-plugins/vite-react 还在维护吗?

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