【问题标题】:ng build fails with "export not found" errors within my code after update to v8更新到 v8 后,我的代码中的 ng 构建失败并出现“未找到导出”错误
【发布时间】:2019-11-08 11:41:17
【问题描述】:

从 v7 更新到 v8 后,ng 构建失败并出现类似的几个错误。

奇怪的是,这完全是我的代码,在 v7 中运行得非常好。我找不到代码有任何问题,WebStorm 索引器也没有。如何解决此类问题?

我多次删除并重新安装了 node_modules。

ERROR in ./src/app/login/elevate-login-dialog/elevate-login-dialog.component.ts 17:16-32
"export 'UnauthorizedInfo' was not found in '../../shared/core/api/ahc-api'

编辑:根据要求 ahc.api.ts 的内容。我无法共享整个文件,但这是相关部分:

import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs";
import { AbsBackendService } from "./abs-backend.service";
import { ILogger } from "../../../../utils/logging/logger/logger.interface";

...

export interface UnauthorizedInfo {
        readonly TokenInvalid:boolean;
        readonly RequiredUserGroup?:UserGroup;
        readonly RequiredUserID?:number;
        readonly RequestedResource?:string;
        readonly RequestedRestMethod?:string;
      }

...

【问题讨论】:

  • 共享 ../../shared/core/api/ahc-api 文件。
  • 编辑了帖子
  • 尝试在独立文件中使用接口:github.com/angular/angular-cli/issues/2034
  • 这确实消除了这个特定的错误。但我看不出它背后的逻辑。此外,您链接的问题是关于类中产生警告而不是错误的接口。不幸的是,还有更多此类错误,将每个接口放入其自己的文件中将花费很长时间,而且由于我们的基础设施,甚至不可能使用 atm。此外,还有框架源文件受到影响。我一开始就不明白这个问题。
  • 好的,看起来这个问题可能与此相关:github.com/angular/angular-cli/issues/14876 感谢您为我指明正确的方向!

标签: angular build angular8


【解决方案1】:

这是 angular-cli 8.0.4 中引入的回归错误

一个简单的

npm install @angular-devkit/build-angular@0.800.3 @angular/cli@8.0.3

“修复”了我的代码库中的问题

【讨论】:

    猜你喜欢
    • 2021-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多