Hello!
I am developing an application using ionic. The platforms i target are mobile phones application (Not through the browser).My application depends on this library node-ytdl-core. I want to be able to call the library from my ts files .
Now i have some question :
-
How can i install this js library ? What is the preferred way? i have researched a bit and i found this ways:
- Use
ionic add
, but its deprecate. - Use bower to install the package via the git link. But the project doesn’t seems to rely on bower, but rather on npm.One more thing is that i cant find the library on bower, but its on NPM.
- Use npm to install the library, for me this is the most straight forward method. But i have read that you shouldn’t mess with the npm dependencies because its manged only for the ionic project dependencies and native plugins.
- Use
-
Can the ionic/cordova even run Node.js modules? It seems logical since cordova and ionic are written in Node.js, but i have read that its not the case, also there are repositories that add the support, like jxcore-cordova . Is this plugin necessary even if the module is written in pure js?
-
How to access the library ?Lets say i have installed the library, how can i call it from ts ? since typescript can have javascript inside of it, and can run other js files, how should i call the lib ?Is it just easy as importing it regularly?
import {ytdl-core} from 'node-ytdl-core'
Or do i have to call node.js files separately?
Any help is much appreciated.