jfcere / ngx-malihu-scrollbar

Angular 2+ scrollbar customization using Malihu jQuery Custom Scrollbar plugin
https://jfcere.github.io/ngx-malihu-scrollbar
MIT License
58 stars 17 forks source link

Typescript error (Cannot find type definition file for 'jquery' and 'mcustomscrollbar') #41

Closed Carlosps closed 5 years ago

Carlosps commented 5 years ago

Hello,

Once I do include the "types": [ "jquery", "mcustomscrollbar" ], I get

[app-scripts] [10:15:52] typescript error [app-scripts] Cannot find type definition file for 'jquery'. [app-scripts] Cannot find type definition file for 'mcustomscrollbar'. [app-scripts] [10:15:52] typescript error in my logs.

Also, when I do open the browser I get the

Refused to apply style from 'http://localhost:8100/build/main.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

Any ideas how to solve this?

jfcere commented 5 years ago

Can you share your repository on Github? I could take a look...

Carlosps commented 5 years ago

https://github.com/Carlosps/myAppScrollbar

Carlosps commented 5 years ago

As I am using it on an Ionic project with Angular 5 version, there is no angular.json file or equivalent.

Not sure where I should place the style and scripts.

jfcere commented 5 years ago

Hi @Carlosps,

Your project doesn't have an angular.json file because you use Ionic v3 which is not compatible with Angular 6. I would suggest you to start a project with the new Ionic v4 which comes with an angular.json file and will ease the integration of 3rd party library like this one (and benefit from all the optimizations done with Angular 6 release or, even better, freshly released Angular 7).

I am not a expert with Ionic but from what I've read if you want to stick with Ionic v3 you would have to add a copy.config.js script to copy external libraries to the build folder. You can look at this blog for the how to: https://zerone-consulting.blog/2017/10/10/steps-to-include-custom-cssjs-files-in-ionic-3/

Does it answer your question correctly?

jfcere commented 5 years ago

Following the link I gave you, I've added the copy.config.js file to your repository which contains the scripts that must be copied to your build folder when serving the application (I've included both JQuery and MalihuCustomScrollbar dependencies to the script).

I've submitted a PR to your repository.

jfcere commented 5 years ago

Closing the issue as it is not related to the library but on how to integrate a third-party library to Ionic 3 and I've submitted a PR to your repository to fix your issue.