question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 issue

Type 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:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
babealcommented, Nov 13, 2018

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 be import { XdListViewComponent } from 'avanade-packagr'

0reactions
github-actions[bot]commented, Jun 19, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module not found: Error: can't resolve the component. ...
Module not found : Error: can't resolve the component. Facing issue when trying to import component from a package made using ng-packagr.
Read more >
module not found: error: can't resolve angular
I have a simple app created with Angular-CLI, I wanted to refactor and move the app.component.ts code in separate component file and started...
Read more >
Server-side rendering (SSR) with Angular Universal
A Node.js Express web server compiles HTML pages with Universal based on client requests. To create the server-side application module, app.server.module.ts , ...
Read more >
ng-packagr
Let's walk through a getting started that'll build an Angular library from TypeScript sources and create a distribution-ready npm package: ...
Read more >
The Best Way To Architect Your Angular Libraries
How to create Angular library implementing clean architecture from ... on our feature we might want to generate default module and component ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found