rpaschoal / ng-chat

💬 A simple facebook/linkedin lookalike chat module for Angular applications.
MIT License
153 stars 92 forks source link

Module build failed #25

Closed henriquecm closed 6 years ago

henriquecm commented 6 years ago

I received this message on my first try to run after importing the module.

./node_modules/ng-chat/index.ts
Module build failed: Error: ...\node_modules\ng-chat\index.ts is missing from the TypeScript 
compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign 
of a badly packaged library. Please open an issue in the library repository to alert its author and ask 
them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).

My dependencies:

 "dependencies": {
   "@angular/animations": "^5.2.0",
   "@angular/cdk": "^5.0.4",
   "@angular/common": "^5.2.0",
   "@angular/compiler": "^5.2.0",
   "@angular/core": "^5.2.0",
   "@angular/flex-layout": "^2.0.0-beta.12",
   "@angular/forms": "^5.2.0",
   "@angular/http": "^5.2.0",
   "@angular/material": "^5.0.4",
   "@angular/platform-browser": "^5.2.0",
   "@angular/platform-browser-dynamic": "^5.2.0",
   "@angular/router": "^5.2.0",
   "@covalent/core": "^1.0.0-rc.1",
   "angular-pipes": "^6.5.3",
   "angular2-moment": "^1.7.0",
   "core-js": "^2.4.1",
   "hammerjs": "^2.0.8",
   "ng-chat": "^1.0.1",
   "ng2-img-cropper": "^0.9.0",
   "ng2-img-tools": "^1.1.2",
   "ng2-validation": "^4.2.0",
   "rxjs": "^5.5.2",
   "zone.js": "^0.8.14"
 },
henriquecm commented 6 years ago

I made some more tests, and it work on "ng build --prod", this error hust happens on "ng serve --host 0.0.0.0"

rpaschoal commented 6 years ago

Hi @powerhcm8

It seems to me that your project is trying to compile the typescript under the ng-chat dependency. That isn't necessary, the files are already compiled on NPM so you just have to import the module.

rpaschoal commented 6 years ago

@powerhcm8

You can exclude your node_modules folder in your tsconfig file with this:

"exclude": [ "node_modules" ]

Or if you want to exclude just the ng-chat folder:

"exclude": [ "node_modules/ng-chat" ]

henriquecm commented 6 years ago

Neither of the options worked.

I ran your demo here and it worked, I think it's because I am using angular 5. When I tried to upgrade to angular 5, it started to give the same error.

rpaschoal commented 6 years ago

@powerhcm8,

I've managed to reproduce the issue when I upgraded to the latest version of angular-cli.

Will investigate it further and see what is going on.

rpaschoal commented 6 years ago

@powerhcm8,

I've followed up this to help me in understanding what is going on: https://github.com/angular/angular-cli/issues/8284

I've made a few changes and released 1.0.2 so you can use it in your project, you will just have to add the following include in your tsconfig file for the time being:

"include": [ "node_modules/ng-chat/**/*" ]

I will have to investigate a new way of packaging and distributing this module due to that change in the angular-cli and the TS compilation restriction changes. I will be looking into "ng-packagr" as suggested by someone in the Angular team. https://github.com/dherges/ng-packagr

rpaschoal commented 6 years ago

Hi @powerhcm8,

I've released 1.0.3 which is using ng-packagr to transpile and package this project.

There is no need to change your tsconfig for this library in order for your project to run anymore (As per 1.0.2 temporary fix).

Please let me know if this is working for you now.

Cheers!

rpaschoal commented 6 years ago

Closing this as it was fixed on #27

henriquecm commented 6 years ago

Sorry for the delay, I was working on another project and couldn't test it. It is working perfectly now, thanks.

rpaschoal commented 6 years ago

No worries mate!

Thanks for reporting the issue @powerhcm8. I've got 1.0.4 coming with sound notifications, will get it up on NPM this weekend most likely. 🎉

If you have any suggestions on new features, feel free to post an issue with a list of suggestions, most welcome! 👍

Cheers!