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

190
Views
Developing a local npm package

I am developing a npm package. Lets call it my-library. I publish this package to a private npm repository which is pulled by many of my projects. How can I quickly develop the code in my-library without having to publish a new version of my-library every time I make a small change?

Take the following workflow for example:

  1. I make a change to my-library. The change is still in development so I don't want to publish it to all my consumers yet, but I do want to test it locally.
  2. I run npm pack to create a local .tgz file.
  3. In one of my dependent projects, say my-consumer I update the package.json to reference this local .tgz file. "my-library": "file:../some/path/my-package.tgz"
  4. I run npm install in my-consumer and my local package is not installed and I can test my app.

Now, there isn't anything apparently wrong with the aforementioned steps, but say I am very quickly iterating on my-library and I want to make and test changes very quickly. Is there any way I can make the above process go faster? Running pack and install for every little change takes time and is much slower than if this were hot-reloading. Can I configure my package.json in my-consumer to use a cached version of my-library that is not in the node_modules folder and skip some of the above steps? I also don't want this to introduce any dependency issues.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I'm using npm/yarm link for that. it allows you to symlink your library to your project, and therefore have the most updated code without any publish and install.

Basically the syntax is:

cd /path/to/lib
yarn link
cd /path/to/project
yarn link myLibName

Take a look at the yarn link docs.

about 4 years ago · Juan Pablo Isaza 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!