跪拜 Guibai
← All articles
Frontend · Uni-app

A UniApp Starter Template Shrinks 40 Scripts and 80 Dependencies Down to 2 and 14

By skiyee ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

UniApp projects targeting WeChat and other Chinese mini-program platforms carry heavy configuration overhead that slows onboarding and upgrades. A template that collapses the stack into one auditable dependency and interactive tooling removes a persistent source of friction for teams maintaining cross-platform apps.

Summary

oiyo-unibest is a project template that merges the oiyo framework with the unibest UniApp starter, cutting configuration and dependency bloat across four layers. The command layer replaces 40-plus platform-specific dev and build scripts with two interactive commands that let developers pick a target at runtime. The Vite configuration shrinks from over 150 lines across 20-plus plugins to seven lines through a single OiyoPlugin that bakes in routing, layouts, auto-imports, and the HTTP client.

The dependency tree drops from 80-plus packages to 14, with @skiyee/oiyo absorbing the entire @dcloudio and @uni-helper ecosystem. On the code side, App.vue gains native template support that survives page navigation without pinia, subpackages are auto-detected from a packages/ directory, and a built-in HTTP module handles requests, retries, and cancellation without third-party libraries like axios or alova.

Takeaways
40-plus npm scripts for per-platform dev and build commands are replaced by two interactive commands that prompt for the target platform at runtime.
Vite configuration drops from over 150 lines across 20-plus plugins to seven lines via a single OiyoPlugin that handles routing, layouts, auto-import, and HTTP.
Total dependencies fall from 80-plus packages to 14, with @skiyee/oiyo absorbing the @dcloudio and @uni-helper suites into one version-tracked package.
App.vue supports a persistent template that does not reset variables on page navigation, removing the need for pinia to hold root-level state.
Subpackages placed in a packages/ directory are auto-detected; manual vite.config.ts declarations are no longer required.
A built-in HTTP module provides request, upload, download, configuration derivation, lifecycle hooks, automatic retry, and request cancellation without third-party libraries.
Project scaffolding runs via pnpm create oiyo --template=unibest, followed by pnpm install and pnpm dev.
Conclusions

Collapsing 80-plus dependencies into one auditable package trades ecosystem flexibility for upgrade simplicity—a bet that matters most on teams where dependency drift across @dcloudio versions causes hard-to-diagnose build failures.

The interactive command pattern solves a real UX problem in UniApp: platform targets (h5, mp-weixin, app, etc.) are easy to mistype and hard to memorize, so moving selection to a runtime prompt eliminates a class of errors that documentation alone never fixes.

Making App.vue template state survive page navigation without pinia is a meaningful architectural correction; the prior workaround of App.ku.vue as a component that resets on route change was a leaky abstraction that forced global state management where it shouldn't have been needed.

Concepts & terms
UniApp
A Vue-based framework for building applications that compile to multiple platforms—iOS, Android, Web, and various Chinese mini-program ecosystems (WeChat, Alipay, Baidu, etc.)—from a single codebase.
unibest
A popular UniApp starter template that provides preconfigured tooling, directory structure, and plugin integrations to speed up cross-platform app development.
oiyo
A framework that wraps UniApp's underlying tooling into a single plugin and dependency, reducing configuration boilerplate and providing built-in HTTP, routing, and layout capabilities.
Subpackage (分包)
A mini-program optimization technique that splits an app into independently loadable packages, reducing initial download size. Each subpackage typically requires explicit configuration in the build tool.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗