Sencha Cmd:支持 object/array 解构

Sencha Cmd: Support for object/array destructuring

Sencha Cmd 是否可以针对较新的 js 功能进行调整或由其他 minifiers/optimizers 替换? 或者无论如何都支持最新版本?

由于版本还没有弄清楚,我就4.2.6来描述

  1. 转到项目的根目录并 运行
npm init
  1. 安装巴贝尔:
npm install --save-dev  babel-cli babel-preset-es2015
  1. 添加到您的 package.json 运行 脚本:
"scripts" : {
    "build-prod": "./node_modules/.bin/babel es6 -d app --comments=false --compact=true",
    "build-debug": "./node_modules/.bin/babel es6 -d app --sourceMaps=true",
    "watch": "./node_modules/.bin/babel es6 -d app --watch"
  },
  1. 将源代码从 appapp.js 移动到另一个文件夹(例如将其命名为 es6
mv app.js app
mv app es6
  1. 并在根目录中创建 build.xml 并将新任务粘贴到项目标签中:
    <target name="-before-build">
        <x-shell reloadprofile="true" dir="${basedir}">
            npm run build-debug
        </x-shell>
    </target>