Transpile issue after upgrading to latest ionic


#1

Hi, I upgraded to version 3.1.2 of Ionic App Scripts and version 3.9.2 of Ionic. When I do an “Ionic serve” it works fine. When I try to build in Prod mode it fails with “Failed to transpile TypeScript”:

I thought it might be something to do with the new "ngo" compiler option, however disablign it with the command below does not help.
This release adds support for ngo, the Angular team’s build optimizer tool. ngo is enabled by default on --prod builds. In the event that ngo is not working for your app or something goes wrong, it can be disabled by running the following build command: ionic cordova build ios --aot --minifyjs --minifycss --optimizejs

13:38:26]  typescript: C:/git/QueMesaMobile/src/core/utilities/push-notification.service.ts, line: 51
            Type '{ android: { senderID: string; }; ios: { alert: "true"; badge: "true"; sound: "true"; }; windows:...' 
            is not assignable to type 'PushOptions'. Types of property 'android' are incompatible. Type '{ senderID:
            string; }' is not assignable to type 'AndroidPushOptions'. Object literal may only specify known properties,
            and 'senderID' does not exist in type 'AndroidPushOptions'.

      L50:  android: {
      L51:      senderID: this.environmentService.environment.androidPushNotificationSenderId
      L52:  },

Error: Failed to transpile TypeScript
    at errorCheckProgram (C:\git\QueMesaMobile\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:119:39)
    at Object.<anonymous> (C:\git\QueMesaMobile\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:89:21)
    at step (C:\git\QueMesaMobile\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:32:23)
    at Object.next (C:\git\QueMesaMobile\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:13:53)
    at fulfilled (C:\git\QueMesaMobile\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:4:58)
[13:38:26]  copy finished in 17.27 s

cli packages: (C:\git\QueMesaMobile\node_modules)

@ionic/cli-utils  : 1.18.0
ionic (Ionic CLI) : 3.18.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.1.2
Cordova Platforms  : android 6.2.3 browser 4.1.0 ios 4.3.1
Ionic Framework    : ionic-angular 3.9.2

System:

Node : v6.10.0
npm  : 3.10.10
OS   : Windows 10

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : legacy

#2

There is probably your error, depending of your versions, sendedID isn’t a valid parameter of the PushObject anymore.

Which versions of @ionic-native/push and (probably) phonegap-plugin-push are you using?

P.S.: The error popup on compilation with --prod because extra checks are performed

P.P.S.: In my case, just checked my git history, I removed this information end of September while upgrading to ionic-angular 3.7.0 and app-scripts 3.0.0 and my upgrade to phonegap-plugin-push 2.0.0 was already done one month before.


#3

Hmmm you are probably right. This has thrown me into a whole day of upgrade hell :wink:

I upgraded the push packages which then needed a newer version of the Android Cordova platform… then I got a strange cloud build error (resolved here, but only with 6.2.3. 6.4.0 and 6.3.0 do not work) -https://ionic.zendesk.com/hc/en-us/articles/115012901127-Android-build-failure-Failed-to-install-Android-SDK-Platform-26

I upgraded the Push notification and it seems that SenderID is no longer needed - however I see no way of passing it in. I did a test and I am not getting push notifications - do you remember how you upgraded this?

I’m now testing all my native plugins (I have upgraded everything to the current latest - 4.4.2) before doing the build script upgrade.

Thanks for the advice - hopefully I can get it working…


#4

@rodneyjoyce

  1. About your android sdk error, have a look at https://stackoverflow.com/questions/39760172/you-have-not-accepted-the-license-agreements-of-the-following-sdk-components maybe you will find your solution there (“funny” someone else faced the exact same thing yesterday too License issues: Android SDK Platform 26)

  2. About SENDER_ID, according my Git history I’ve just removed it, nothing else nothing more. And I could confirm that my push notifications are still working. I use like I said phonegap-plugin-push >2 (respectively right now 2.1.0). I searched then my SENDER_ID in my all project, I found a reference in package.json (which actually I think is not used) and more important I found a reference in google-services.json (see https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/INSTALLATION.md).

Are you using phonegap-plugin-push >2 too? Did you configure this file too?

P.S.: Back in my days :wink: I documented the all migration to version 2.0 of the push plugin there Phonegap Push Plugin 2.0.0 released … if that could help