【发布时间】:2017-02-21 09:53:33
【问题描述】:
使用ionic build android 命令构建android 时出现错误
ngc:错误:静态解析符号值时遇到错误。对本地(非导出)符号“字典”的引用。考虑导出符号(原始 .ts 文件中的位置 14:8),解析符号 TRANSLATION_PROVIDERS
translation.ts 文件中的代码
export const TRANSLATIONS = new OpaqueToken('translations');
// all traslations
const dictionary : any = {
[LANG_EN_NAME]: LANG_EN_TRANS,
[LANG_AR_NAME]: LANG_AR_TRANS,
[LANG_FR_NAME]: LANG_FR_TRANS
};
// providers
export const TRANSLATION_PROVIDERS : any = [
{ provide: TRANSLATIONS, useValue: dictionary},
];
我的 app.module.ts 代码
import {TRANSLATION_PROVIDERS,TranslatePipe,TranslateService} from './translate';
@NgModule({
declarations: [
MyApp,
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
],
providers: [TRANSLATION_PROVIDERS,TranslateService ]
})
export class AppModule {}
关于这个问题的任何建议,顺便说一下,当我使用 ionic serve 命令时,我的项目通过转换 100% 工作
【问题讨论】:
-
你能创建一个最小的 git repo 吗?
标签: android angular typescript compilation ionic2