aws-mobile-ionic-sample icon indicating copy to clipboard operation
aws-mobile-ionic-sample copied to clipboard

Can not build the app with --prod option

Open ndnparis opened this issue 8 years ago • 3 comments

Hi, On browser and build without --prod option, it works. I got the following errors when I build the app with --prod option. Ex : ionic cordova build android --prod <----> 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 /home/develop/Ionic/ionic-aws/client/src/app/app.module.ts, resolving symbol AppModule in /home/develop/Ionic/ionic-aws/client/src/app/app.module.ts, resolving symbol AppModule in /home/develop/Ionic/ionic-aws/client/src/app/app.module.ts, resolving symbol AppModule in /home/develop/Ionic/ionic-aws/client/src/app/app.module.ts at syntaxError (/home/develop/Ionic/ionic-aws/client/node_modules/@angular/compiler/bundles/compiler.umd.js:1550:34) at simplifyInContext (/home/develop/Ionic/ionic-aws/client/node_modules/@angular/compiler/bundles/compiler.umd.js:23870:23) at StaticReflector.simplify (/home/develop/Ionic/ionic-aws/client/node_modules/@angular/compiler/bundles/compiler.umd.js:23882:13) at StaticReflector.annotations (/home/develop/Ionic/ionic-aws/client/node_modules/@angular/compiler/bundles/compiler.umd.js:23331:41) at NgModuleResolver.resolve (/home/develop/Ionic/ionic-aws/client/node_modules/@angular/compiler/bundles/compiler.umd.js:13883:70) at CompileMetadataResolver.getNgModuleMetadata (/home/develop/Ionic/ionic-aws/client/node_modules/@angular/compiler/bundles/compiler.umd.js:14473:60) at addNgModule (/home/develop/Ionic/ionic-aws/client/node_modules/@angular/compiler/bundles/compiler.umd.js:23050:58) at /home/develop/Ionic/ionic-aws/client/node_modules/@angular/compiler/bundles/compiler.umd.js:23061:14 at Array.forEach () at _createNgModules (/home/develop/Ionic/ionic-aws/client/node_modules/@angular/compiler/bundles/compiler.umd.js:23060:26)

Thanks in advance.

The content of my app.module.ts file import { NgModule, ErrorHandler } from '@angular/core' import { BrowserModule } from '@angular/platform-browser' import { HttpModule } from '@angular/http' import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular' import { StatusBar } from '@ionic-native/status-bar' import { SplashScreen } from '@ionic-native/splash-screen' import { FormsModule } from '@angular/forms'

import { MyApp } from './app.component'

import { EventsPage } from '../pages/events/events' import { HomePage } from '../pages/home/home' import { TabsPage } from '../pages/tabs/tabs' import { LoginModal } from '../modal/login/login' import { LogoutModal } from '../modal/logout/logout' import { AddEventModal } from '../modal/addevent/addevent'

import { AwsConfig } from './app.config' import { AuthService, AuthServiceProvider } from './auth.service' import { ProjectStore, ProjectStoreProvider } from './project.store' import { EventStore, EventStoreProvider } from './event.store' import { Sigv4Http, Sigv4HttpProvider } from './sigv4.service'

import { ChartsModule } from 'ng2-charts' import { momentFromNowPipe } from './momentFromNow.pipe'

@NgModule({ declarations: [ MyApp, EventsPage, HomePage, TabsPage, LoginModal, LogoutModal, AddEventModal, momentFromNowPipe ], imports: [ HttpModule, BrowserModule, IonicModule.forRoot(MyApp, new AwsConfig().load()), FormsModule, ChartsModule ], bootstrap: [IonicApp], entryComponents: [ MyApp, EventsPage, HomePage, TabsPage, LoginModal, LogoutModal, AddEventModal ], providers: [ StatusBar, SplashScreen, {provide: ErrorHandler, useClass: IonicErrorHandler}, AuthService, AuthServiceProvider, ProjectStore, ProjectStoreProvider, EventStore, EventStoreProvider, Sigv4Http, Sigv4HttpProvider ] }) export class AppModule {}

ndnparis avatar Oct 29 '17 15:10 ndnparis

Same issue here building for ios (using ionic cli 3.15.2)

ionic cordova build ios --prod Running app-scripts build: --prod --platform ios --target cordova [23:11:06] build prod started ... [23:11:06] clean started ... [23:11:06] clean finished in 1 ms [23:11:06] copy started ... [23:11:06] ngc started ... 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 /Users/F1ERCE/workspace/aws/aws-mobile-ionic-sample/client/src/app/app.module.ts, resolving symbol AppModule in /Users/F1ERCE/workspace/aws/aws-mobile-ionic-sample/client/src/app/app.module.ts, resolving symbol AppModule in /Users/F1ERCE/workspace/aws/aws-mobile-ionic-sample/client/src/app/app.module.ts, resolving symbol AppModule in /Users/F1ERCE/workspace/aws/aws-mobile-ionic-sample/client/src/app/app.module.ts at Error (native) at syntaxError (/Users/F1ERCE/workspace/aws/aws-mobile-ionic-sample/client/node_modules/@angular/compiler/bundles/compiler.umd.js:1550:34) at simplifyInContext (/Users/F1ERCE/workspace/aws/aws-mobile-ionic-sample/client/node_modules/@angular/compiler/bundles/compiler.umd.js:23870:23) at StaticReflector.simplify (/Users/F1ERCE/workspace/aws/aws-mobile-ionic-sample/client/node_modules/@angular/compiler/bundles/compiler.umd.js:23882:13) at StaticReflector.annotations (/Users/F1ERCE/workspace/aws/aws-mobile-ionic-sample/client/node_modules/@angular/compiler/bundles/compiler.umd.js:23331:41) at NgModuleResolver.resolve (/Users/F1ERCE/workspace/aws/aws-mobile-ionic-sample/client/node_modules/@angular/compiler/bundles/compiler.umd.js:13883:70) at CompileMetadataResolver.getNgModuleMetadata (/Users/F1ERCE/workspace/aws/aws-mobile-ionic-sample/client/node_modules/@angular/compiler/bundles/compiler.umd.js:14473:60) at addNgModule (/Users/F1ERCE/workspace/aws/aws-mobile-ionic-sample/client/node_modules/@angular/compiler/bundles/compiler.umd.js:23050:58) at /Users/F1ERCE/workspace/aws/aws-mobile-ionic-sample/client/node_modules/@angular/compiler/bundles/compiler.umd.js:23061:14 at Array.forEach (native)

youngfeldt avatar Oct 30 '17 03:10 youngfeldt

ionic info

cli packages: (/Users/F1ERCE/.npm-packages/lib/node_modules)

@ionic/cli-utils  : 1.15.2
ionic (Ionic CLI) : 3.15.2

global packages:

cordova (Cordova CLI) : 7.0.1

local packages:

@ionic/app-scripts : 2.1.3
Cordova Platforms  : ios 4.4.0
Ionic Framework    : ionic-angular 3.6.0

System:

Node  : v6.11.2
npm   : 3.10.10
OS    : macOS Sierra
Xcode : Xcode 9.0 Build version 9A235

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : legacy

youngfeldt avatar Oct 30 '17 03:10 youngfeldt

Did you guys find a solution? @ndnparis @youngfeldt

lucazbrandao avatar Jan 29 '19 01:01 lucazbrandao