0

Description I have exported the package from a different app and trying to use that package in a different application as a dependency. I am getting the following error when trying to import components from that package.

  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'

in 'C:\Users\aditi.malviya\work\xd.ng.starter.demo.app\src\app\core\component-dynamic-loader'

How To Reproduce 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 statement:

  import { XdListViewComponent } from 'avanade-packagr/src/app/modules/xd- 
  components/xd-list-view/xd-list-view.component';
Aditi
  • 1
  • 1
  • What is the library name you had given for `xd-components.module` ? – Sunil Singh Oct 15 '18 at 07:11
  • @SunilSingh xd-components.module is the module name just like app.module.ts. So in the index.ts file, I am trying to export everything from the xd-components module. – Aditi Oct 15 '18 at 08:46
  • ng-packagr has issues with barrelling. Remove index.ts file and import directly. It might work. Here is the barrelling issue: https://github.com/ng-packagr/ng-packagr/issues/567 – dreamerkumar Oct 22 '18 at 19:17

0 Answers0