尝试迁移到Angular 9时出错:为导出的符号生成的元数据中遇到错误

时间:2020-08-20 16:04:21

标签: angular typescript monorepo nrwl-nx

我正在尝试将Angular 8应用程序转换为Angular9。在运行迁移命令时,我看到了:

Undecorated classes with DI migration.
      As of Angular 9, it is no longer supported to use Angular DI on a class that does not have an Angular decorator.
      Read more about this here: https://v9.angular.io/guide/migration-undecorated-classes
    
        This migration uses the Angular compiler internally and therefore projects that no longer build successfully after the update cannot run the migration. Please ensure there are no AOT compilation errors and rerun the migration. The following project failed: libs/core/tsconfig.lib.json
    
        Error: ~/core-routing.module.ts:138:1: Error encountered in metadata generated for exported symbol 'CoreRoutingModule':
         ~/core/src/lib/core-routing.module.ts:25:23: Metadata collected contains an error that will be reported at runtime: Lambda not supported.
          {"__symbolic":"error","message":"Lambda not supported","line":24,"character":22}
    
        Could not migrate all undecorated classes that use dependency
        injection. Some project targets could not be analyzed due to
        TypeScript program failures.
    
        Migration can be rerun with: "ng update @angular/core --migrate-only migration-v9-undecorated-classes-with-di"
    
      Migration completed.

Nx workspace : 8.12.0

Angular : 8

1 个答案:

答案 0 :(得分:0)

strictMetadataEmit是库的标志,因此完全不应有任何延迟加载的模块。它不打算用于应用程序。

"strictMetadataEmit": false,