加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Angular AOT Build:内部错误:未定义的未知标识符

发布时间:2020-12-17 07:12:51 所属栏目:安全 来源:网络整理
导读:我目前的角度项目在角度支持AOT功能之前就开始了.现在我正试图让它发挥作用.我收到以下错误,我不知道这意味着什么,我可以开始调试问题.有谁知道为什么会出现这个错误? 依赖 "@angular/animations": "^4.4.4","@angular/common": "^4.4.4","@angular/compile
我目前的角度项目在角度支持AOT功能之前就开始了.现在我正试图让它发挥作用.我收到以下错误,我不知道这意味着什么,我可以开始调试问题.有谁知道为什么会出现这个错误?

依赖

"@angular/animations": "^4.4.4","@angular/common": "^4.4.4","@angular/compiler": "^4.4.4","@angular/core": "^4.4.4","@angular/forms": "^4.4.4","@angular/platform-browser": "^4.4.4","@angular/platform-browser-dynamic": "^4.4.4","@angular/router": "^4.4.4","@ngx-translate/core": "^8.0.0","@ngx-translate/http-loader": "^2.0.0","core-js": "^2.5.1","font-awesome": "^4.7.0","primeng": "^4.2.1","quill": "^1.3.2","rxjs": "^5.4.3","zone.js": "^0.8.18"

错误

ERROR in Error: Internal error: unknown identifier undefined
at Object.importExpr$$1 [as importExpr] (...node_modules@angularcompilerbundlescompiler.umd.js:24211:23)
at tokenExpr (...node_modules@angularcompilerbundlescompiler.umd.js:18577:39)
at providerDef (...node_modules@angularcompilerbundlescompiler.umd.js:18480:20)
at ...node_modules@angularcompilerbundlescompiler.umd.js:18697:77
at Array.map (<anonymous>)
at NgModuleCompiler.compile (...node_modules@angularcompilerbundlescompiler.umd.js:18697:44)
at AotCompiler._compileModule (...node_modules@angularcompilerbundlescompiler.umd.js:24144:32)
at ...node_modules@angularcompilerbundlescompiler.umd.js:24056:66
at Array.forEach (<anonymous>)
at AotCompiler._compileImplFile (...node_modules@angularcompilerbundlescompiler.umd.js:24056:19)
at ...node_modules@angularcompilerbundlescompiler.umd.js:23969:87
at Array.map (<anonymous>)
at AotCompiler.emitAllImpls (...node_modules@angularcompilerbundlescompiler.umd.js:23969:52)
at CodeGenerator.emit (...node_modules@angularcompiler-clisrccodegen.js:42:46)
at ...node_modules@angularcompiler-clisrccodegen.js:33:61
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)

解决方法

这部分应用程序导致了这个问题:

export function windowFactory(): any {
    return window;
}

providers: [{
    provide: Window,useFactory: windowFactory
}],

Github: This fails with AoT compiler in Angular CLI,because Window (the browser window) is an interface

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读