Search code examples
angularnpm-link

ERROR in No NgModule metadata found for 'AppModule'


I'm using Angular 6.0.7. I'm trying to debug one of my packages locally. For that I'm using npm link. But when I try to serve the application it throws an error,

ERROR in No NgModule metadata found for 'AppModule'.

Following are the steps I followed to link my package

  1. npm link on my package folder
  2. npm link my-package on my application folder
  3. In ts-config file of my application I included my package as "include": ["./node_modules/my-package"]

And on the angular.json file "preserveSymlinks": true. Before linking the package locally the application works perfectly. Am I missing something here? Any help would be appreciated.


Solution

  • I was able to fix my issue by doing some changes to the tsconfig file. Hope this helps someone whose having a similar issue. I had to include the .ts files in my tsconfig like below,

    "include": [
       "**/*.ts",
       "./node_modules/my-package"
     ]