Why Taro 2.0 Switched to Webpack: A Deep Dive into the New Build System
The article explains how Taro's fast‑evolving 1.x series led to a disruptive redesign of its CLI, replacing the custom build system with webpack in version 2.0, and outlines the resulting maintenance, stability, and extensibility benefits along with upgrade guidance.
Taro 1.x was launched in September of the previous year and has since seen rapid growth, with major releases such as 1.1 (full support for WeChat, Baidu, Alipay mini‑programs), 1.2 (conversion of existing WeChat mini‑programs and support for ByteDance), and 1.3 (JSX, Hooks, quick‑app, and QQ mini‑program support).
Although the framework iterated quickly, its core architecture remained largely unchanged, making the project feel stagnant for teams seeking breakthrough improvements, prompting a decision to undertake a disruptive redesign.
The original Taro CLI build system was self‑developed and complex, leading to three main issues:
Maintenance difficulty – adding simple features like JSON parsing required direct changes to the CLI, reducing flexibility.
Collaboration barriers – the tangled codebase and numerous logic branches made it hard for external contributors to get involved.
Limited extensibility – the initial design did not anticipate future extensions, leaving developers without a clear path to add custom functionality.
To address these problems, the team decided to adopt webpack for mini‑program compilation, resulting in the beta release of Taro 2.0.
The new build system brings several advantages over the old one:
Improved maintainability – most compilation logic is delegated to webpack, allowing the Taro team and contributors to focus on a few plugins.
Greater stability – leveraging webpack reduces the occurrence of obscure errors that were common with the custom system.
Strong extensibility – developers can add custom loaders and plugins to tailor the build process to their needs.
Developers can try the new system now by installing 2.0.0-beta.2. Note that version 2.0 introduces significant changes to project compilation configuration; upgrading existing projects requires following the configuration documentation at https://github.com/NervJS/taro/blob/feat_mini_webpack/docs/config-detail.md.
The CLI overhaul is just the beginning. The team plans a series of further redesigns that may eventually reshape Taro's overall design philosophy, while committing to smooth, incremental upgrades.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Aotu Lab
Aotu Lab, founded in October 2015, is a front-end engineering team serving multi-platform products. The articles in this public account are intended to share and discuss technology, reflecting only the personal views of Aotu Lab members and not the official stance of JD.com Technology.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
