0

我已将Angular 8 应用程序更新为 Angular 9。一切运行良好,如果我使用 启动应用程序ng serve,但如果我使用 启动应用程序ng serve --prod,我会在运行时收到以下错误:

ReferenceError: SomeAbstractModelClass is not defined
    at http://localhost:4200/main.js:1:330907
    at Module.zUnb (http://localhost:4200/main.js:1:331001)
    at l (http://localhost:4200/runtime.js:1:552)
    at Object.0 (http://localhost:4200/main.js:1:96)
    at l (http://localhost:4200/runtime.js:1:552)
    at t (http://localhost:4200/runtime.js:1:421)
    at Array.r [as push] (http://localhost:4200/runtime.js:1:293)
    at http://localhost:4200/main.js:1:47

我不知道问题可能是什么,因为所有内容都带有一些警告。

WARNING in .../projects/apps/editor/src/test.ts is part of the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig.

我还尝试禁用常春藤。:

  "angularCompilerOptions": {
    "enableIvy": false
  }

然后我收到以下错误消息:

ReferenceError: SomeOtherModelClass is not defined
    at http://localhost:4200/main.js:1:364834
    at Module.zUnb (http://localhost:4200/main.js:1:364923)
    at l (http://localhost:4200/runtime.js:1:552)
    at Object.0 (http://localhost:4200/main.js:1:96)
    at l (http://localhost:4200/runtime.js:1:552)
    at t (http://localhost:4200/runtime.js:1:421)
    at Array.r [as push] (http://localhost:4200/runtime.js:1:293)
    at http://localhost:4200/main.js:1:47

SomeOtherModelClass是扩展另一个抽象类的类。

这个问题的原因可能是什么?如果我能提供更多信息,请告诉我。

4

2 回答 2

1

这似乎是一个错误

如果在应用"emitDecoratorMetadata"程序中设置为也以生产模式运行。falsetsconfig.json

于 2020-02-13T21:21:52.433 回答
0

如前所述,"emitDecoratorMetadata": false在根中tsconfig.json修复它。

我还需要将它设置true为我src/tsconfig.test.json的开玩笑,否则我不断收到这个 DI 错误:

Can't resolve all parameters for StoreService: (?, ?)
于 2021-01-21T11:07:50.487 回答