Module not found: Error: can't resolve the component. Facing issue when trying to import component from a package made using ng-packagr.
See original GitHub issueType of Issue
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” } } commands: npm run packagr cd dist npm pack npm install “package url”
import statement: import { XdListViewComponent } from ‘avanade-packagr/src/app/modules/xd-components/xd-list-view/xd-list-view.component’;
Expected Behaviour
_A bug: The component should get imported in the app from the package.
Version Information
$ node_modules/.bin/ng-packagr --5.10.0
"ng-packagr": "^1.7.0",
@angular/*: ^4.2.6
typescript: "~2.4.2"
rxjs: "^5.4.0"
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
why are you importing from this path?
import { XdListViewComponent } from 'avanade-packagr/src/app/modules/xd-components/xd-list-view/xd-list-view.component';
? Shouldn’t the import statement just beimport { XdListViewComponent } from 'avanade-packagr'
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem. This action has been performed automatically by a bot.