parcel

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Parcel

Parcel

Parcel is the "Zero Config" bundler. It works out of the box for React, Vue, Rust (Wasm), and more. v2.12 uses Lightning CSS for extreme performance.
Parcel 是一款“零配置”打包工具。它开箱即可支持 React、Vue、Rust (Wasm) 等多种技术栈。v2.12 版本采用 Lightning CSS 以实现极致性能。

When to Use

适用场景

  • Prototypes: You just want
    index.html
    to work.
  • Simple Apps: You don't want to maintain a 500-line config file.
  • Polyglot: You have images, Rust, and SCSS mixed together.
  • 原型开发:你只希望
    index.html
    能直接运行。
  • 简单应用:你不想维护长达500行的配置文件。
  • 多语言混合项目:你的项目中混合了图片、Rust 和 SCSS 等多种资源。

Core Concepts

核心特性

Zero Config

零配置

It auto-detects transforms. If you
import './style.scss'
, it installs
sass
automatically.
它会自动检测转换需求。如果你使用
import './style.scss'
,它会自动安装
sass
插件。

Caching

缓存机制

Aggressive filesystem caching makes restarts instant.
激进的文件系统缓存让重启瞬间完成。

Workers

多线程处理

Parallelizes work across all cores.
利用所有核心 CPU 并行处理任务。

Best Practices (2025)

2025年最佳实践

Do:
  • Use
    <script type="module">
    : Point Parcel at your HTML file as the entry.
  • Use
    macros
    : Parcel supports build-time macros.
Don't:
  • Don't fight the auto-install: Let Parcel manage its plugins.
推荐做法
  • 使用
    <script type="module">
    :将 HTML 文件作为 Parcel 的入口文件。
  • 使用
    macros
    :Parcel 支持构建时宏。
不推荐做法
  • 不要抗拒自动安装:让 Parcel 管理其插件。

References

参考资料