Ionic build failed


#1

[14:28:21] ngc: Error: Error encountered resolving symbol values statically. Fu nction calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 23:23 in the original .ts file), re solving symbol AppModule in C:/Users/A4P1/Desktop/Liverpool/.tmp/app/app.module.ts

my app.module.ts

import { NgModule } from ‘@angular/core’;
import { IonicApp, IonicModule } from ‘ionic-angular’;
import { MyApp } from ‘./app.component’;
import { AboutPage } from ‘…/pages/about/about’;
import { ContactPage } from ‘…/pages/contact/contact’;
import { HomePage } from ‘…/pages/home/home’;
import { TabsPage } from ‘…/pages/tabs/tabs’;
import {HttpModule} from ‘@angular/http’;
import {Http} from ‘@angular/http’;
import {BrowserModule} from “@angular/platform-browser”;
import { TranslateModule} from “ng2-translate/ng2-translate”;
import { TranslateLoader, TranslateStaticLoader } from “ng2-translate/src/translate.service”;
@NgModule({
declarations: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage
],
imports: [
BrowserModule,
HttpModule,
IonicModule.forRoot(MyApp),
TranslateModule.forRoot({
provide: TranslateLoader,
useFactory: (http: Http) => new TranslateStaticLoader(http, ‘assets/i18n’, ‘.json’),
deps: [Http]}),
IonicModule.forRoot(MyApp)

],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage
],

providers: []

})
export class AppModule {}


#2

Read this https://github.com/ocombe/ng2-translate/issues/248


#3

I have tried all of the answers I can find (including 248 referenced above) for this but am still getting the same error re function calls not supported when I do ionic build ios.

My app.modules.ts looks like this:

import { NgModule } from '@angular/core';
import { IonicApp, IonicModule } from 'ionic-angular';
import { Camera } from 'ionic-native';
import { Http, XSRFStrategy, CookieXSRFStrategy  } from '@angular/http';
import { Storage  } from '@ionic/storage';
import { FormsModule }   from '@angular/forms';
import { MyApp } from './app.component';
import { AboutPage } from '../pages/about/about';
import { HomePage } from '../pages/home/home';
import { TabsPage } from '../pages/tabs/tabs';
import { LoginPage } from '../pages/login/login';
import { PhotoPage } from '../pages/photo/photo';
import { AboutPage } from '../pages/about/about';
import { GalleryPage } from '../pages/gallery/gallery';
import { SubmittedPage } from '../pages/submitted/submitted';
import { PhotoPage } from '../pages/photo/photo';
import { ResetPasswordPage } from '../pages/reset-password/reset-password';
import { SignupPage } from '../pages/signup/signup';
import { DjangoAuth } from '../providers/djangoAuth';
import { ImageData } from '../providers/imageData';

@NgModule({
  declarations: [
MyApp,
AboutPage,
HomePage,
TabsPage,
LoginPage,
PhotoPage,
GalleryPage,
SubmittedPage,
ResetPasswordPage,
SignupPage
  ],
  imports: [
IonicModule.forRoot(MyApp, [
  Http,
  DjangoAuth,
  ImageData,
  FormsModule,
  {provide:XSRFStrategy, useValue: new CookieXSRFStrategy('csrftoken', 'X-CSRFToken')}])
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    AboutPage,
    HomePage,
    TabsPage,
    LoginPage,
    PhotoPage,
    GalleryPage,
    SubmittedPage,
    ResetPasswordPage,
    SignupPage
  ],
  providers: [
    DjangoAuth,
    ImageData,
    Storage,
    Camera
  ]
})

export class AppModule {}

My error looks like this:

[13:33:53]  ngc: Error: Error encountered resolving symbol values statically. Function calls    are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in /Users/billnoble/Documents/YHistory-App3/.tmp/app/app.module.ts, resolving symbol AppModule in /Users/billnoble/Documents/YHistory-App3/.tmp/app/app.module.ts
   at simplifyInContext (/Users/billnoble/Documents/YHistory-App3/node_modules/@angular/compiler-cli/src/static_reflector.js:469:23)
    at StaticReflector.simplify (/Users/billnoble/Documents/YHistory-App3/node_modules/@angular/compiler-cli/src/static_reflector.js:472:22)
    at StaticReflector.annotations (/Users/billnoble/Documents/YHistory-App3/node_modules/@angular/compiler-cli/src/static_reflector.js:61:36)
    at _loop_1 (/Users/billnoble/Documents/YHistory-App3/node_modules/@angular/compiler-cli/src/codegen.js:53:54)
    at CodeGenerator.readFileMetadata (/Users/billnoble/Documents/YHistory-App3/node_modules/@angular/compiler-cli/src/codegen.js:66:13)
    at /Users/billnoble/Documents/YHistory-App3/node_modules/@angular/compiler-cli/src/codegen.js:100:74
    at Array.map (native)
    at CodeGenerator.codegen (/Users/billnoble/Documents/YHistory-App3/node_modules/@angular/compiler-cli/src/codegen.js:100:35)
    at codegen (/Users/billnoble/Documents/YHistory-App3/node_modules/@angular/compiler-cli/src/main.js:7:81)
    at Object.main (/Users/billnoble/Documents/YHistory-App3/node_modules/@angular/tsc-wrapped/src/main.js:30:16)