Angular ng构建AOT时的角度2错误+;从不同的包延迟加载

Angular ng构建AOT时的角度2错误+;从不同的包延迟加载,angular,npm,lazy-loading,angular-cli,Angular,Npm,Lazy Loading,Angular Cli,我有一个angular 2应用程序,它是我应用程序的主要入口 在这个应用程序中,我正在安装另一个angular npm包,它包含了我模块的所有代码 这个npm包像使用AOT的angular库一样编译,并将其发布到私有npm 下面是一个带有错误的示例应用程序。 要了解问题,请执行以下操作: 复制回购协议 npm安装 npm运行开发人员:库 在主应用程序模块中,我有以下延迟加载路径: const routes: Routes = [ { path: 'underwriting',

我有一个angular 2应用程序,它是我应用程序的主要入口

在这个应用程序中,我正在安装另一个angular npm包,它包含了我模块的所有代码

这个npm包像使用AOT的angular库一样编译,并将其发布到私有npm

下面是一个带有错误的示例应用程序。

要了解问题,请执行以下操作:

  • 复制回购协议
  • npm安装
  • npm运行开发人员:库
  • 在主应用程序模块中,我有以下延迟加载路径:

    const routes: Routes = [
        {   path: 'underwriting',
            loadChildren: '@h2o/underwriting/src/underwriting/underwriting.module#UnderwritingModule' 
        }
    ];
    
    在主应用程序中运行
    ng build--aot
    时出现错误

    ERROR in ./src/$$_gendir async
    Module not found: Error: Can't resolve 'C:\Users\Juan.Pablo\projects\POC\h2o.web\packages\h2o.app\src\node_modules\@h2o\underwriting\src\underwriting\underwrit
    ing.module.d.ngfactory.ts' in 'C:\Users\Juan.Pablo\projects\POC\h2o.web\packages\h2o.app\src\$$_gendir'
    @ ./src/$$_gendir async
    @ ./~/@angular/core/@angular/core.es5.js
    @ ./src/main.ts
    @ multi ./src/main.ts
    
    它表明包名
    @h2o/submission
    未正确转换为路径,并且由于它是模块路径的基础,因此产生该错误

    ng build正在尝试查找(检查额外的src,如模块是否在主应用程序src中)

    应该是什么时候

    'C:\Users\Juan.Pablo\projects\POC\h2o.web\packages\h2o.app\node_modules\@h2o\underwriting\src\underwriting\underwrit
    ing.module.d.ngfactory.ts'
    
    'C:\Users\Juan.Pablo\projects\POC\h2o.web\packages\h2o.app\node_modules\@h2o\underwriting\src\underwriting\underwrit
    ing.module.d.ngfactory.ts'