1

I have an angular 7 library called LibA (created with ng g library ...), there I have installed an NPM package named DependencideA. Objects from DependencideA I have imported only in NgModuleA and its Components.

Now when I'm using my NPM package LibA in an Angular App, I have following error: error TS2307: Cannot find module 'DependencideA'. Even if I don't import the NgModuleA from LibA (but I have imported NgModuleB from LibA, which don't use DependencideA!).

Why I need this DependencideA, even I don't use objects from there? Is there a way to avoid this without splitting LibA?

EDIT:

Here an example: https://github.com/admir86/LibSample

I'm using verdaccio as npm proxy to publish the LibA and install it in the LibAConsumer project.

gyc
  • 4,300
  • 5
  • 32
  • 54
admir86
  • 368
  • 1
  • 3
  • 13
  • I didn't use verdaccio, instead I directly used from local path and it ran without any errors. So, what I did: 1. In LibAProject, `npm run build`. 2. In LibAConsumer > `package.json` > changed line of lib-a : `"lib-a": "../LibAProject/dist/lib-a",`. – shhdharmen Feb 06 '19 at 05:59
  • @shhdharmen I have updated the package.json. please run `npm run pack` in LibAProject and then `npm install` in LibAConsumer. So the LibAConsumer will have the compressed package like installed via npm or verdaccio. The error will appear. – admir86 Feb 08 '19 at 11:22

0 Answers0