MiniProgram Build Tool

7.0.3 · active · verified Sun Apr 19

miniprogram-build is a command-line interface (CLI) tool designed to streamline the development workflow for WeChat MiniPrograms. It handles common build tasks such as compiling TypeScript to JavaScript, SCSS/Sass/CSS to MiniProgram's WXSS, HTML/WXML to WXML, and JSON/JSONC to JSON, alongside image compression and file copying. The current stable version is 7.0.3, with frequent patch releases indicating active maintenance. Unlike a framework, it serves as an automation and enhancement tool for existing MiniProgram projects, emphasizing a build-and-watch approach. Its key differentiators include comprehensive support for modern web technologies (TypeScript, SCSS) within the MiniProgram ecosystem and direct integration with the WeChat Developer Tools for features like automatic preview and project upload.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to install, initialize, and run `miniprogram-build` for development and production builds within a MiniProgram project.

{
  "name": "my-miniprogram-project",
  "version": "1.0.0",
  "description": "A simple WeChat MiniProgram project",
  "scripts": {
    "dev": "miniprogram-build dev",
    "build": "miniprogram-build build --production",
    "init": "miniprogram-build init"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "miniprogram-build": "^7.0.0",
    "typescript": "^5.0.0",
    "tslib": "^2.0.0"
  }
}

// To get started, first install as a dev dependency:
npm install miniprogram-build typescript tslib -D

// Then, create a default configuration file:
npx miniprogram-build init

// Or view all available commands:
npx miniprogram-build -h

// To run in development mode (build and watch):
npm run dev

// To build for production:
npm run build

view raw JSON →