Hi,
I give a try on new AWS template from https://github.com/ionic-team/ionic2-starter-aws, everything looks great.
However, when I try to build prod release by ionic cordova build android --prod --release
, error like below appears.
I assume the error roots from here IonicModule.forRoot(MyApp, new AwsConfig().load()) in app.module.ts and it is related to AOT compiler feature. But I haven’t found fix on this.
Anybody has any hint?
Thanks,
Danielle
Error: Error encountered resolving symbol values statically. Calling function 'AwsConfig',
function calls are not supported. Consider replacing the function or lambda with a reference to an exported function,
resolving symbol AppModule in app.module.ts, resolving symbol AppModule
app.config.ts with AwsConfig
defined
import { Injectable } from '@angular/core';
declare var AWS: any;
declare const aws_mobile_analytics_app_id;
declare const aws_cognito_region;
declare const aws_cognito_identity_pool_id;
declare const aws_user_pools_id;
declare const aws_user_pools_web_client_id;
declare const aws_user_files_s3_bucket;
@Injectable()
export class AwsConfig {
public load() {
// Expects global const values defined by aws-config.js
const cfg = {
"aws_mobile_analytics_app_id": aws_mobile_analytics_app_id,
"aws_cognito_region": aws_cognito_region,
"aws_cognito_identity_pool_id": aws_cognito_identity_pool_id,
"aws_user_pools_id": aws_user_pools_id,
"aws_user_pools_web_client_id": aws_user_pools_web_client_id,
"aws_user_files_s3_bucket": aws_user_files_s3_bucket
};
AWS.config.customUserAgent = AWS.config.customUserAgent + ' Ionic';
return cfg;
}
}