Angular Library Module Import Error

I created an angular library using ng generate library. All the file were generated correctly. However when I try to import the library module inside my app module I get the red squiggly error if I import the module from the library name. The project will build and run properly but I would like to fix the annoying error. The error only goes away if I import the module from the exact path.

 

Error:
Class JetpackModule is not an Angular module:
Inspection Info: Reports any symbols that are declared, imported or exported by an Angular module that are not modules, components, directives or pipes or can’t be used in the context of the property.

 

 

Another side effect of this error is the component tag squiggly.

Error:

Component or directive matching jp-jetpack element is out of the current Angular module's scope.

Inspection Info: Reports tags, which are defined by components or directives out of current scope. 

 

 

4 comments

try un-excluding the dist directory (from the folder right-click menu, choose Mark directory as/Not Excluded) - does the issue persist?

1

Yeah, I also have this issue and I excluded the dist dir.

0

It should be not neccessary to mark not excluded when a library is referenced in the tsconfig.json.

I think this should be automatically recognized by the ide and force indexed.

0

I fixed it, check if there's no extra tsconfig.app.json nested somewhere. I had one that overrid the others, which caused the paths not to work.

0

Please sign in to leave a comment.