当使用Ivy编译器在Angular 9中构建应用程序时,我收到消息:
> ERROR in The target entry-point "device-variables" has missing dependencies:
- ./lib/pages/variables-list-flat/variables-list-flat.component
- ./lib/pages/variables-edit-import/variables-edit-import.component
- ./lib/components/dialogs/set-base-path-dialog/set-base-path-dialog.component
- ./lib/pages/variables-edit-import/structure-api.service
- ./lib/pages/variables-list-flat/variables-list.service
- ./lib/pages/variables/variables.component
这仅在以生产模式构建时发生。
这些错误来自我在节点模块文件夹中创建的库。
对于上述每个错误,都会打印出另一个错误。我将在此处显示一个示例:
> ERROR in node_modules/device-variables/public-api.d.ts:1:15
- error TS2307: Cannot find module './lib/pages/variables-list-flat/variables-list-flat.component'.
1 export * from './lib/pages/variables-list-flat/variables-list-flat.component';
但是组件肯定在那里。我可以在节点模块中看到它。在d.ts文件和js文件中。
我正在通过包装模块延迟加载模块,如该githb问题底部所示:https://github.com/angular/angular-cli/issues/6373 through a wrapper module
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { Breadcrumb } from 'shared-lib';
import { DeviceVariablesModule, VariablesComponent } from 'device-variables';
@NgModule({
imports: [
DeviceVariablesModule,
RouterModule.forChild(
[
{
path: '', component: VariablesComponent,
data: {
breadcrumbs: [
new Breadcrumb([
{ lang: 'de', value: 'Variablen' },
{ lang: 'en', value: 'Measurements' }
], '/measurements', null, true)
]
},
}
])
]
})
export class DeviceVariableBrowserWrapper { }
我确实尝试导出错误输出中列出的所有文件,但仍然引发错误。库中我的公共API看起来像这样
/*
* Public API Surface of device-variables
*/
// COMPONENTS
export * from './lib/pages/variables/variables.component';
// MODULE
export * from './lib/device-variables.module';
有人对解决此问题有任何经验或建议吗?
或我可以提供的更多建议信息?
谢谢