ES2015+ 代码编译成 ES5

需要将 Konva@8.3.14 编译成 ES5,找了一圈没有合适的,自己弄了个,记录下 package.json 配置。

{
  "private": true,
  "scripts": {
    "build": "npm run babel && npm run min",
    "babel": "babel node_modules/konva/konva.js --out-file konva.es5.js",
    "min": "uglifyjs konva.es5.js -o konva.es5.min.js -c -m"
  },
  "dependencies": {
    "konva": "8.3.14"
  },
  "devDependencies": {
    "babel-cli": "6.26.0",
    "babel-preset-es2015": "6.24.1",
    "babel-preset-stage-2": "6.24.1",
    "uglify-js": "3.17.4"
  },
  "browserslist": "last 2 versions",
  "babel": {
    "presets": [
      "es2015",
      "stage-2"
    ]
  }
}
posted @ 2022-12-13 18:06  神仙梨子丶  阅读(98)  评论(0编辑  收藏  举报