Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

192
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda