【问题标题】:Minification error with some Angular modalInstance.opened method某些 Angular modalInstance.opened 方法的缩小错误
【发布时间】:2017-01-16 13:26:29
【问题描述】:

我已经编写了一组 gulp 命令来缩小 JS 代码。除非我在特定的 JS 文件中包含以下代码段,否则它工作正常。

//============================== Ledger Card Modal =================================== //KR: Check
    vm.ledgerCardWindowOption = function (matterReferenceNo) {
        var busy = busyIndicatorService.setAsBusy('CompanyName.main');
        vm.ledgerCardGlyphicon = true;
        $scope.modalInstance = $modal.open({
            scope: $scope,
            templateUrl: 'app/ledgerCard/ledgerCardView.html',
            backdrop: 'static',
            controller: 'ledgerCardController as vm',
            windowClass: 'ledgercard-modal-window',
            resolve: {
                ledgerCardModal: function () {
                    var data = { matterReferenceNo: matterReferenceNo, formType: "Modal" };
                    return data;
                }
            }
        });
        $scope.modalInstance.opened.then(() => busy.resolve(), () => busy.resolve()); // This is the bad line
    };
    //============================== Ledger Card Modal End ===================================
    //==============================auto height fix===================================

错误信息:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error
    at new JS_Parse_Error (eval at <anonymous> (C:\dev.net14\DevelopmentPhase2\CompanyName.WebMain\node_modules\uglify-js\tools\node.js:30:4), <anonymous>:1533:18)
    at js_error (eval at <anonymous> (C:\dev.net14\DevelopmentPhase2\CompanyName.WebMain\node_modules\uglify-js\tools\node.js:30:4), <anonymous>:1541:11)
    at croak (eval at <anonymous> (C:\dev.net14\DevelopmentPhase2\CompanyName.WebMain\node_modules\uglify-js\tools\node.js:30:4), <anonymous>:2088:9)
    at token_error (eval at <anonymous> (C:\dev.net14\DevelopmentPhase2\CompanyName.WebMain\node_modules\uglify-js\tools\node.js:30:4), <anonymous>:2096:9)
    at unexpected (eval at <anonymous> (C:\dev.net14\DevelopmentPhase2\CompanyName.WebMain\node_modules\uglify-js\tools\node.js:30:4), <anonymous>:2102:9)
    at expr_atom (eval at <anonymous> (C:\dev.net14\DevelopmentPhase2\CompanyName.WebMain\node_modules\uglify-js\tools\node.js:30:4), <anonymous>:2617:13)
    at maybe_unary (eval at <anonymous> (C:\dev.net14\DevelopmentPhase2\CompanyName.WebMain\node_modules\uglify-js\tools\node.js:30:4), <anonymous>:2791:19)
    at expr_ops (eval at <anonymous> (C:\dev.net14\DevelopmentPhase2\CompanyName.WebMain\node_modules\uglify-js\tools\node.js:30:4), <anonymous>:2826:24)
    at maybe_conditional (eval at <anonymous> (C:\dev.net14\DevelopmentPhase2\CompanyName.WebMain\node_modules\uglify-js\tools\node.js:30:4), <anonymous>:2831:20)
    at maybe_assign (eval at <anonymous> (C:\dev.net14\DevelopmentPhase2\CompanyName.WebMain\node_modules\uglify-js\tools\node.js:30:4), <anonymous>:2855:20)

我已经指出了上面代码的错误行,但我无法弄清楚那里有什么问题。谁能给我解释一下?

【问题讨论】:

    标签: javascript angularjs gulp gulp-uglify


    【解决方案1】:

    您正在使用ES6 功能,您需要使用transpilier 来转换ES5 中的那些代码。

    https://www.npmjs.com/package/gulp-babel

    uglify 之前,将ES2015 转换为ES5

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-12
      • 2020-05-09
      相关资源
      最近更新 更多