Have ideas to improve npm?Join in the discussion! »

miniprogram-build

2.1.0 • Public • Published

miniprogram-build

build miniprogram with typescript & scss

Features

  • js
    • compile TS
    • sourcemaps
    • replace {{var}}
    • build break
    • tree shaking
    • one tslib
  • wxss
    • compile
      • scss/sass
      • css
    • import node_modules
    • sourcemaps
    • minify (release) / expanded (debug)
    • inline image
    • inline svg
    • PostCSS & cssnano & inline svg compress
    • keep import wxss
    • build break
    • skip local scss _
  • wxml/html ==> wxml
    • copy rename
    • compress
  • svg ==> iconfonts
    • svg ==> iconfont
    • build wxss
  • JSON
    • jsonc (添加注释)
    • minify
    • replace {{var}}
  • resource
    • copy/src
    • image compress
  • console verbose
    • all files
    • file size
  • miniprogram native npm
    • link node_modules
    • rollup js lib
    • components

Todo

  • exlude path
  • init
  • pages config
  • template project

Usage

install

npm i miniprogram-build -D

Command

mp-build [task] [--flags]

task

  • build compile all files from src/ to dist/
  • watch watch src files change and update dist
  • dev = build+watch
  • clean remove dist

flags

  • --config={CONFIG_FILE_JSON} using config file
  • --debug open debug mode
  • --release build for release with optimization

examples

  • dev in int env
mp-build dev --config=./config.int.json 
  • build for prod release
mp-build build --config=./config.prod.json --release 

default config

{
    "release": false,
    "debug": false,
    "src": "src",
    "dist": "dist",
    "exclude": "",
    "tsconfig": "tsconfig.json",
    "var": {
        "APP_ID": "all {{APP_ID}} in json/ts files will replaced by this value"
    }
}

Install

npm i [email protected]

Version

2.1.0

License

MIT

Unpacked Size

34.7 kB

Total Files

26

Last publish

Collaborators

  • avatar