wwto: An Open‑Source Cross‑Mini‑Program Migration Solution
The wwto project, open‑sourced by 58.com in March 2020, provides a near‑zero‑cost solution for converting WeChat mini‑programs into other platform mini‑programs through a three‑layer architecture of compilation, runtime adaptation, and integration tools, offering extensive features, core advantages, and a roadmap for future expansion.
Open‑Source Project Series (Part 2)
Project name: wwto – a cross‑platform migration solution launched by 58.com that can convert a WeChat mini‑program into other mini‑programs (Alipay, Baidu, Toutiao) with almost zero cost, improving development efficiency and reducing maintenance overhead. The source code is available at https://github.com/wuba/wwto .
Key Features (since March 2020)
Conversion chain: WeChat mini‑program → other mini‑programs.
Compile‑time syntax transformation.
Runtime API adaptation.
Linter checking tool for compatibility issues.
Plugin conversion support.
CLI for one‑click conversion.
Process logs displayed during execution.
Why wwto is needed
With the rapid rise of mini‑programs, each platform has its own syntax and API, forcing developers to rewrite the same application multiple times. wwto leverages 58 TEG’s technology to provide a unified migration path, enabling a single codebase to run on multiple platforms.
Project Architecture
wwto consists of three layers:
Compilation Layer : Processes WeChat mini‑program syntax and compiles it into the target platform’s syntax.
Runtime Layer : Adapts WeChat APIs to the target platform’s APIs, handling missing APIs, parameter mapping, and result wrapping.
Integration Layer : Provides CLI tools, logger, and a sophisticated linter that scans code for compatibility issues and warns developers.
Typical Migration Challenges and Solutions
1. Component style leakage in Alipay mini‑programs – solved by post‑CSS modularization and DOM parsing to rename class names.
2. Inconsistent lifecycle functions – addressed by injecting Alipay‑specific lifecycle wrappers that call the corresponding WeChat lifecycle.
Additional issues such as mismatched API parameters, missing triggerEvent methods, and differing component lifecycles are also handled.
Core Advantages
Cross‑platform migration reduces development cost.
Fast integration with minimal code changes.
Simple CLI usage with no learning curve.
Generated code is readable and extensible.
Broad coverage: supports Baidu, Alipay, Toutiao mini‑programs and plugins.
Open‑Source Significance & Future Plans
The growing mini‑program ecosystem makes cross‑platform development increasingly burdensome; wwto aims to alleviate this by providing a reliable conversion tool. Future work includes expanding platform support, stabilizing existing conversions, and adding new API mappings.
Contribution & Feedback
Developers are invited to fork the repository, submit PRs or Issues, and help improve the tool. Detailed usage, startup instructions, and contribution guidelines are in the GitHub repository.
Author
Li Zhongqiu – Senior Front‑End Engineer at 58.com, responsible for front‑end toolchains and common platform development.
58 Tech
Official tech channel of 58, a platform for tech innovation, sharing, and communication.
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.