Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

287
Views
how do I use npm package or can I just use the code directly

This is a very generic question and I have been wondering this for a while.

I am working on an angular application, and I am using few open source npm packages. One way is to npm install these packages and then use the provided features in that way. But I think ( haven't try ) there is another way which is directly pull the source code from the open source project and then embed the code into my application. It should work. The benefit is that I can easily modify the open source code to fit my needs.

Is that true and feasible?

appreciate your andswer and thanks in advance!

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

There's a few reasons you might not want to take this approach:

  1. LEGAL: Open source code usually has rules about its reuse, stating that you must include a particular license or attribution; grabbing the code without doing your due diligence and making sure you are using it properly could wind you up in some sort of legal hot water.
  2. SECURITY/STABILITY: Open source code is generally being constantly iterated on to provide security patches, bug fixes, and other improvements. Grabbing wholesale chunks of code and hardcoding them into your site fully decouples you from this process.
  3. ORGANIZATION: Leveraging open source code with a package manager like npm gives you insight into all the packages you are using, the specific version you are using, and peer dependencies you might require. Separating yourself from this with hardcoding means much more mystery should things start to go wrong.

While grabbing a small snippet from a library and adjusting it for your needs might be feasible in certain cases that are limited in size and scope, I would not make a habit of doing so. Alternatives would be submitting a PR to the library in question to provide the behavior you require, or forking the library and maintaining a separate version (that way you could pull in upstream changes).

over 4 years ago · Santiago Trujillo Report

0

I really recommend using npm install to use it in your angular app. If you want to change the code source of that open source library, I suggest the following :

  1. First fork the library in your github
  2. perform your changes
  3. Publish the forked library as a new npm package
  4. npm install your new forked library

Note : Please be carefull to the liscence of open source project. You should be aware of the LEGAL rights that allow you to do that.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!