taro 打包命令详细使用教程

taro-cli

安装好 NPM 或 Yarn 后,就可以全局安装 Taro 开发工具 @tarojs/cli 了。

如果你是使用 NPM 安装,使用如下命令:

$ npm install -g @tarojs/cli

taro -V 打印版本号

taro init myapp 创建模板项目

微信小程序编译预览及打包:

# npm script

$ npm run dev:weapp

$ npm run build:weapp

# 仅限全局安装

$ taro build --type weapp --watch

$ taro build --type weapp

# npx 用户也可以使用

$ npx taro build --type weapp --watch

$ npx taro build --type weapp

百度小程序编译预览及打包:

# npm script

$ npm run dev:swan

$ npm run build:swan

# 仅限全局安装

$ taro build --type swan --watch

$ taro build --type swan

# npx 用户也可以使用

$ npx taro build --type swan --watch

$ npx taro build --type swan

支付宝小程序编译预览及打包:

# npm script

$ npm run dev:alipay

$ npm run build:alipay

# 仅限全局安装

$ taro build --type alipay --watch

$ taro build --type alipay

# npx 用户也可以使用

$ npx taro build --type alipay --watch

$ npx taro build --type alipay

H5 编译预览及打包:

# npm script

$ npm run dev:h5

# 仅限全局安装

$ taro build --type h5 --watch

# npx 用户也可以使用

$ npx taro build --type h5 --watch

React Native

React Native 端运行需执行如下命令,React Native 端相关的运行说明请参见 React Native 教程。

# npm script

$ npm run dev:rn

# 仅限全局安装

$ taro build --type rn --watch

# npx 用户也可以使用

$ npx taro build --type rn --watch

更新 Taro

Taro 提供了更新命令来更新 CLI 工具自身和项目中 Taro 相关的依赖。

更新 taro-cli 工具:

# taro

$ taro update self

# npm

npm i -g @tarojs/cli@latest

# yarn

yarn global add @tarojs/cli@latest

更新项目中 Taro 相关的依赖,这个需要在你的项目下执行。

$ taro update project

你可能感兴趣的:(taro 打包命令详细使用教程)