Unexpected token operator «=», expected punc «,»

When I run building command for android :

ionic cordova  build android --prod --release

Then I get the following error message :

[14:22:53]  build prod started ...
[14:22:53]  clean started ...
[14:22:53]  clean finished in 4 ms
[14:22:53]  copy started ...
[14:22:53]  ngc started ...
[14:22:59]  ngc finished in 5.41 s
[14:22:59]  preprocess started ...
[14:22:59]  deeplinks started ...
[14:22:59]  deeplinks finished in 273 ms
[14:22:59]  optimization started ...
[14:23:00]  copy finished in 6.74 s
[14:23:07]  optimization finished in 7.77 s
[14:23:07]  preprocess finished in 8.04 s
[14:23:07]  webpack started ...
[14:23:12]  webpack finished in 4.91 s
[14:23:12]  sass started ...
[14:23:12]  uglifyjs started ...
[14:23:12]  sass finished in 837 ms
[14:23:12]  cleancss started ...
[WARN] Error occurred during command execution from a CLI plugin (@ionic/cli-plugin-cordova).
Error: Unexpected token operator «=», expected punc «,» in G:\ionicProjects\***-app\www\build\main.js at line 73330, col 38, pos 2600834


Ionic Info :

global packages:

    Cordova CLI : 7.0.1

local packages:

    @ionic/app-scripts : 1.3.6
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.1.1

System:

    Node : v6.11.0
    OS   : Windows 8.1
    npm  : 3.10.10


Cordova Plugins :

cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-camera 2.4.1 "Camera"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-dialogs 1.3.3 "Notification"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-statusbar 2.2.1 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
cordova-plugin-x-socialsharing 5.1.8 "SocialSharing"
cordova.plugins.diagnostic 3.6.5 "Diagnostic"
es6-promise-plugin 4.1.0 "Promise"
ionic-plugin-keyboard 2.2.1 "Keyboard"
mx.ferreyra.callnumber 0.0.2 "Cordova Call Number Plugin"
uk.co.workingedge.phonegap.plugin.launchnavigator 4.0.3 "Launch Navigator"

How can I solve this problem ?

What is here?

Where did you run ionic info?
What is your output of ionic -v?

What is here?

sorry, i didn’t get it !

Where did you run ionic info?

in project root folder

What is your output of ionic -v?

3.6.0

What is in main.js at line 73330, col 38, pos 2600834?

line 73330 is :

function debounce(fn, wait, immediate = false) {

and this is the whole function block:

function debounce(fn, wait, immediate = false) {
    var /** @type {?} */ timeout, /** @type {?} */ args, /** @type {?} */ context, /** @type {?} */ timestamp, /** @type {?} */ result;
    return function () {
        context = this;
        args = arguments;
        timestamp = Date.now();
        var /** @type {?} */ later = function () {
            var /** @type {?} */ last = Date.now() - timestamp;
            if (last < wait) {
                timeout = setTimeout(later, wait - last);
            }
            else {
                timeout = null;
                if (!immediate)
                    result = fn.apply(context, args);
            }
        };
        var /** @type {?} */ callNow = immediate && !timeout;
        if (!timeout) {
            timeout = setTimeout(later, wait);
        }
        if (callNow)
            result = fn.apply(context, args);
        return result;
    };
}

Upgrade ionic-app-scripts and see this issue for more information.

after upgrading app-script , the error message become :

Error: Uglify failed: Unexpected token operator «=», expected punc «,» in undefined at line undefined, col undefined, pos undefined

:frowning_face:

I’ve been struggling with this issue for a week now, and didn’t manage to find a solution. I’ve also reported it at app-scripts repository at github. As far as I understood, it’s about not including ES6-modules into the project; which is somehow weird, as babel will transform the compiled ES6 code to ES5 anyway.

Hi

Finally, I figured out the bug.
it was caused by “IsUndefined()” method which was imported from “es2015/util”

I appreciate your time and effort, thank you so much.