简体   繁体   中英

How to use npm packages in an angular 2 app?

I want to send some UDP packets from my angular 2 app. While searching for a solution I found some npm packages that look like they could do the job.

I thought I could just install and use this packages in angular but it did not work. Some research reavled some howtos but they look very diferent so that I am totally confused.

Can I use every npm package with angular? If yes, how?

No, not every package; there are limits. Browserify implements replacements for many of Node's built-in APIs, but not everything is possible in the browser.

This is discussed in the compatibility section of the documentation.

If a package relies upon an built-in API that is not browser-compatible - or relies upon native code - it won't work. And, as far as I am aware, sending UDP packets is not going to be possible.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM