部署

部署中遇到的问题

通过capistrano部署代码时,报UglifyJs错误

这个问题,通常是因为UglifyJs不支持ES2015语法,而一些npm包中又有这种新语法,导致编译失败。

临时解决办法:删除UglifyJs插件

config/webpack/production.js
const environment = require('./environment')
environment.plugins.delete("UglifyJs")
module.exports = environment.toWebpackConfig()

或者:

添加babel-present-stage-2, 关闭uglify

yarn add babel-present-stage-2

配置.babelrc

{
  "presets": [
    ["env", {
      "modules": false,
      "targets": {
        "browsers": "> 1%",
        "uglify": false
      },
      "useBuiltIns": true
    }],
    "stage-2"
  ],
  ...
}

Last updated