Hello!
I have upgraded to the latest ionic 3.9.2 and when I run android build with ionic cordova build android --prod --release
I get:
Running app-scripts build: --prod --platform android --target cordova
[10:26:31] build prod started ...
[10:26:31] clean started ...
[10:26:31] clean finished in 2 ms
[10:26:31] copy started ...
[10:26:31] deeplinks started ...
[10:26:32] deeplinks finished in 547 ms
[10:26:32] ngc started ...
[GTypeError: Cannot read property 'kind' of undefined
at nodeCanBeDecorated (H:\src\trunk\src\ionic\rms\node_modules\typescript\lib\typescript.js:7805:35)
at nodeIsDecorated (H:\src\trunk\src\ionic\rms\node_modules\typescript\lib\typescript.js:7825:16)
at Object.nodeOrChildIsDecorated (H:\src\trunk\src\ionic\rms\node_modules\typescript\lib\typescript.js:7829:16)
at isDecoratedClassElement (H:\src\trunk\src\ionic\rms\node_modules\typescript\lib\typescript.js:51668:23)
at isInstanceDecoratedClassElement (H:\src\trunk\src\ionic\rms\node_modules\typescript\lib\typescript.js:51659:20)
at Object.filter (H:\src\trunk\src\ionic\rms\node_modules\typescript\lib\typescript.js:1652:25)
at getDecoratedClassElements (H:\src\trunk\src\ionic\rms\node_modules\typescript\lib\typescript.js:51641:23)
at generateClassElementDecorationExpressions (H:\src\trunk\src\ionic\rms\node_modules\typescript\lib\typescript.js:51815:27)
at addClassElementDecorationStatements (H:\src\trunk\src\ionic\rms\node_modules\typescript\lib\typescript.js:51804:44)
at visitClassDeclaration (H:\src\trunk\src\ionic\rms\node_modules\typescript\lib\typescript.js:51131:13)
I have investigated the problem and concluded that it is because of annotations like @Expose, @Type from https://github.com/pleerock/class-transformer :
export class Notification {
@Expose({ name: "notId" })
id: number;
@Expose({ name: "title" })
title: string;
@Expose({ name: "message" })
message: string;
foreground: boolean;
coldstart: boolean;
@Type(() => NotificationInfo)
info: NotificationInfo;
readed: boolean = false;
@Type(() => Date)
created: Date = new Date();
}
What should I change in my code to make the ngc compiler works?
project.json
:
{
...
"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": "5.0.1",
"@angular/compiler": "5.0.1",
"@angular/compiler-cli": "5.0.1",
"@angular/core": "5.0.1",
"@angular/forms": "5.0.1",
"@angular/http": "5.0.1",
"@angular/platform-browser": "5.0.1",
"@angular/platform-browser-dynamic": "5.0.1",
"@ionic-native/core": "4.4.0",
"@ionic-native/deeplinks": "4.4.0",
"@ionic-native/file-transfer": "4.4.0",
"@ionic-native/http": "4.4.0",
"@ionic-native/push": "4.4.0",
"@ionic-native/splash-screen": "4.4.0",
"@ionic-native/status-bar": "4.4.0",
"@ionic/storage": "2.1.3",
"class-transformer": "^0.1.8",
"cordova": "^7.1.0",
"cordova-plugin-advanced-http": "^1.8.1",
"cordova-plugin-device": "^1.1.7",
"cordova-plugin-file": "^4.3.3",
"cordova-plugin-file-transfer": "^1.7.0",
"cordova-plugin-ionic-webview": "^1.1.16",
"cordova-plugin-splashscreen": "^4.1.0",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-sqlite-storage": "^2.1.2",
"ionic-angular": "3.9.2",
"ionic-plugin-deeplinks": "^1.0.15",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "^3.0.0",
"phonegap-plugin-push": "^2.1.0",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18",
"cordova-android": "~6.3.0"
},
"devDependencies": {
"@ionic/app-scripts": "3.1.2",
"typescript": "2.4.2"
},
...
},
"platforms": [
"android"
]
}
}
ionic info
:
cli packages: (h:\npm\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.3.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
Node : v6.9.2
npm : 3.10.10
OS : Windows 7
Environment Variables:
ANDROID_HOME : h:\mobile\android\sdk
Misc:
backend : pro
Thanks in advance!