说明 我已经从其他应用程序导出了该程序包,并尝试在其他应用程序中将该程序包用作依赖项。尝试从该程序包中导入组件时出现以下错误。
ERROR in ./src/app/core/component-dynamic-loader/component-dynamic-loader.component.ts
Module not found: Error: Can't resolve 'avanade-packagr/src/app/modules/xd-components/xd-list-view/xd-list-view.component'
在“ C:\ Users \ aditi.malviya \ work \ xd.ng.starter.demo.app \ src \ app \ core \ component-dynamic-loader”中
如何复制 index.ts:
export * from './xd-components.module';
public_api.ts:
export * from './src/app/modules/xd-components/index';
ng-package.json:
{
"$schema": "./node_modules/ng-packagr/ng-package.schema.json",
"lib": {
"entryFile": "public_api.ts"
},
"externals": {
"moment": "moment",
"lodash": "lodash"
}
}
导入声明:
import { XdListViewComponent } from 'avanade-packagr/src/app/modules/xd-
components/xd-list-view/xd-list-view.component';