Uncaught SyntaxError: Unexpected token =" in "function isNumber(value, ignoreNaN = false)


#1

Hello,

We’ve an error in the android version of our application (ios and browser versions are ok): “Uncaught SyntaxError: Unexpected token =” in “function isNumber(value, ignoreNaN = false)” (seems the default parameters are not recognized)

Here a screenshot.

Some more information:

global packages:

@ionic/cli-utils : 1.4.0
Cordova CLI      : 7.0.0 
Ionic CLI        : 3.4.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : android 6.2.3 ios 4.4.0
Ionic Framework                 : ionic-angular 3.5.0

package.json

{
    "name": "MyApp",
    "version": "0.0.1",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "4.1.0",
        "@angular/compiler": "4.1.0",
        "@angular/compiler-cli": "4.1.0",
        "@angular/core": "4.1.0",
        "@angular/forms": "4.1.0",
        "@angular/http": "4.1.0",
        "@angular/platform-browser": "4.1.0",
        "@angular/platform-browser-dynamic": "4.1.0",
        "@ionic-native/core": "3.7.0",
        "@ionic-native/file": "^3.12.1",
        "@ionic-native/native-storage": "^3.12.1",
        "@ionic-native/sim": "^3.12.1",
        "@ionic-native/splash-screen": "3.7.0",
        "@ionic-native/status-bar": "3.7.0",
        "@ionic-native/three-dee-touch": "^3.10.3",
        "@ionic-native/touch-id": "^3.10.3",
        "@ionic-native/transfer": "^3.12.1",
        "@ionic-native/unique-device-id": "^3.12.1",
        "@ionic/storage": "2.0.1",
        "@ngx-translate/core": "^7.0.0",
        "@ngx-translate/http-loader": "^0.1.0",
        "angular2-uuid": "^1.1.1",
        "cordova-android": "^6.2.3",
        "cordova-plugin-3dtouch": "^1.3.5",
        "cordova-plugin-file": "^4.0.0",
        "cordova-plugin-file-transfer": "^1.6.3",
        "cordova-plugin-nativestorage": "^2.2.2",
        "cordova-plugin-sim": "^1.3.3",
        "cordova-plugin-touch-id": "^3.2.0",
        "cordova-plugin-uniquedeviceid": "^1.3.2",
        "cordova-sqlite-storage": "^2.0.4",
        "intl": "^1.2.5",
        "ionic-angular": "3.2.1",
        "ionic2-calendar": "^0.3.6",
        "ionicons": "3.0.0",
        "linqts": "^1.8.2",
        "moment": "^2.18.1",
        "rxjs": "5.1.1",
        "sw-toolbox": "3.6.0",
        "typescript-dotnet-es6": "^4.9.6",
        "zone.js": "0.8.10",
        "cordova-plugin-console": "1.0.5",
        "cordova-plugin-device": "1.1.4",
        "cordova-plugin-splashscreen": "~4.0.1",
        "cordova-plugin-statusbar": "2.2.2",
        "cordova-plugin-whitelist": "1.3.1",
        "ionic-plugin-keyboard": "~2.2.1"
    },
    "devDependencies": {
        "@ionic/app-scripts": "1.3.7",
        "@ionic/cli-plugin-cordova": "1.4.0",
        "@ionic/cli-plugin-ionic-angular": "1.3.1",
        "typescript": "2.2.1"
    },
    "description": "An Ionic project",
    "cordova": {
        "plugins": {
            "cordova-plugin-nativestorage": {},
            "cordova-sqlite-storage": {},
            "cordova-plugin-3dtouch": {},
            "cordova-plugin-touch-id": {},
            "cordova-plugin-sim": {},
            "cordova-plugin-uniquedeviceid": {},
            "cordova-plugin-file-transfer": {},
            "cordova-plugin-file": {},
            "cordova-plugin-console": {},
            "cordova-plugin-device": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-statusbar": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {}
        }
    }
}

tsconfig.json

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "es2015"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "target": "es5"
  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "node_modules"
  ],
  "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  }
}

Thanks at all for the help.


#3

How exactly are you building your app?


#4

We’re trying from win10 and from mac (with android sdk tools, emulator, gradle installed),
The command we use to build is the same for both:

ionic cordova build android

#5

So building succeeds, but when you then run the app you have a white screen only and this error message in the console, nothing else?
No extra output during the build that could mean something?

Upgrade this to a current version with npm install --save-dev @ionic/app-scripts and try again.


#6

@Sujan12 thanks for your response.
We’ve solved removing the package causing this problem (typescript-dotnet-es6). Maybe this package was in conflict with the target “es5” defined in tsconfig.json.


#7

Maybe.

Strange that it only affected the Android build…