farm-fe /farm
Extremely fast Vite-compatible web build tool written in Rust
★ 5,595⑂ 191👁 17⑃ 1,641● 686▤ 1,097
-1
日增长
5,595
stars
191
forks
17
watchers
1,641
prs
686
issues
1,097
releases
README
Rust native Web 构建工具与官方 Rust 插件生态
English |
简体中文
---
介绍
Farm 是 Rust native Web 构建工具。编译器及内置编译插件在 Rust 中处理模块图、转换、打包与优化,官方 Rust 插件进一步覆盖框架、样式、资源与文档构建。
Node.js 负责配置、CLI 与开发服务器编排;需要时仍会使用 JavaScript 插件、React 渲染与应用运行时。Vite 插件适配器用于渐进迁移,而不是 Farm 架构的定义。
本分支包含 v2 发布候选。源码中的版本与插件实现不代表对应包已在 registry 发布或已完成正式版验收。评估 v2 时应使用匹配且经过验证的候选;@latest 命令安装的是 registry 当前已发布版本。
在线体验
为什么选择 Farm?
Farm 以 Rust 原生编译器和编译扩展为基础,为开发与生产提供统一的插件架构,并结合增量编译、可配置打包和现有 JavaScript 工具的适配能力。架构与迁移说明见为什么需要 Farm。
特性
- Rust native 编译:Rust 编译器与内置插件覆盖脚本、CSS、HTML、JSON、解析及生产优化。
- 官方 Rust 插件家族:覆盖 React/Vue、Sass/Tailwind CSS、自动导入、SVG/图标、数据与资源、Worker/Wasm 及文档工具。功能范围和候选状态见插件总览,不同插件的覆盖程度并不相同。
- 增量工作流:持久缓存、懒编译与热更新;效果取决于项目、配置和缓存状态。
- 局部打包:控制产物分组,开发与生产使用同一编译器基础。
- 可扩展与渐进迁移:支持 Rust/JavaScript 编译插件、运行时插件和 Vite 适配器。请验证项目实际使用的 hooks 与框架功能,不假设所有 Vite 插件都可直接替换。
v2 包发布、各平台原生产物及正式版验收,与源码是否存在分别跟踪。
快速开始
使用任意常用包管理器,即可快速创建一个 Farm 项目:
bash
npm
npm create farm@latest
yarn
yarn create farm@latest
pnpm
pnpm create farm@latest
查看 Farm 文档 了解更多用法。
基准测试
历史基准数据与对应工作负载保留在 performance-compare。这些结果不是本次 v2 候选的实测,也不是对项目耗时的保证。评估 v2 时应固定内容、配置、硬件和缓存状态后再比较。
贡献
查看 贡献指南
交流群
- 作者推特, 官方推特
- 加入 Discord
- 微信交流群
- QQ 群
感谢贡献者们做出的努力
致谢
非常感谢 https://github.com/tmm 给 Farm 团队捐献了 farm npm 包。
感谢:
- SWC 项目由@kdy1创建, 为 Farm 的代码解析、转换和压缩提供了支持。
- NAPI-RS 项目由 @Brooooooklyn创建, 为 Farm 的 node-binding 实现提供了支持。
- Rollup 项目由 @lukastaegert创建, 启发了 Farm 的插件系统的实现。
- Vite 项目由 Evan You创建, 针对 Vite 插件生态的兼容性设计提供了启发。
作者 & 维护者
作者:
- brightwu(吴明亮),, 曾就职于字节跳动。推特
维护者:
- ErKeLost
- shulandmimiTop issues
#1063Support modulePreload when generating html22 comments · 2024-03-24#1026Not working with SvelteKit15 comments · 2024-03-14#125[Feature] Rust Vue SFC compile11 comments · 2023-03-24#1425[Bug Report]: yml This kind of module is not supported10 comments · 2024-06-24#2169[Bug Report]: farm build failed8 comments · 2025-05-28#1204[@farmfe/js-plugin-solid] during the build process, a large number of console prints appeared on the console7 comments · 2024-04-17#1579[Bug Report]: Creating another node_modules directory instead of using the one that's already there6 comments · 2024-07-10#1144preview command adds cross support6 comments · 2024-04-08
Discussions
#2279Use Oxc tools0 comments · 2026-03-11#2278Replace Rollup With Rolldown0 comments · 2026-03-11#2207Why my CSS is broken?1 comments · 2025-07-22#2112Improve template styling1 comments · 2025-03-11#2106【施工中】模块联邦插件&Runtime脑暴0 comments · 2025-03-07#1912What is the proper way to configure SolidJS with TailwindCSS?2 comments · 2024-11-02#1856Debugging run failures1 comments · 2024-10-22#1794Farm Bundle Analyzer1 comments · 2024-09-26