I have an Angular2 cli project (cli 1.0.0-beta.21)
It builds and works fine when using ng build --prod and --dev
But if I try ng build --prod --aot , I get the following error
An error encountered character resolution values. Function calls are not supported. Consider replacing a function or lambda with a link to an exported function, AppModule character resolution
I examined this github problem , but can't figure out where I am going wrong.
Here is my app.module.ts file:
import { BrowserModule } from '@angular/platform-browser';
...
import { LocationStrategy, HashLocationStrategy } from '@angular/common';
import {
dnnModId,
dnnSF,
dnnPortalId,
dnnTabId,
dnnEditMode,
AuthService,
DnnService
} from './services';
import { AppRoutes } from './app.routes';
...
import { ShiftPartialPipe } from './pipes/shift-partial.pipe';
@NgModule({
declarations: [
AppComponent,
...
ShiftEditComponent
],
imports: [
BrowserModule,
...
HttpModule
],
providers: [
AuthGuard,
AuthService,
DnnService,
{ provide: LocationStrategy, useClass: HashLocationStrategy },
{ provide: dnnModId, useValue: moduleId },
{ provide: dnnTabId, useValue: tabId },
{ provide: dnnPortalId, useValue: portalId },
{ provide: dnnEditMode, useValue: editMode },
{ provide: dnnSF, useValue: $.ServicesFramework(moduleId) }
],
bootstrap: [AppComponent]
})
export class AppModule { }
I am importing some external values into my application using opaque tokens, such as:
export let dnnModId: any = new OpaqueToken('moduleId');
export let dnnPortalId: any = new OpaqueToken('portalId');
export let dnnTabId: any = new OpaqueToken('tabId');
export let dnnSF: any = new OpaqueToken('sf');
export let dnnEditMode: any = new OpaqueToken('editMode');
Could this be my problem?
The problem is this line in my application .module.ts
{ provide: dnnSF, useValue: $.ServicesFramework(moduleId) }
:
export let dnnSF: any = new OpaqueToken('sf');
typing.d.ts
declare var $: any;
: CMS, jquery -api . , api. ( , , .)
, AOT?