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

408
Visualizações
how to setup a project to develop on a npm package

I have a git root project where I am using inside my root project a git subproject. So for example I have the project MyApp and a subproject UIComponents. Currently I have cloned the UIComponents repo into my project folder and added UIComponents to .gitignore of the root project. Now I want to build a npm package for UIComponents and I want to be able to switch between npm production build and development. The problem is in development the import is this:

import Button from './UIComponents'

and with the npm package the import is this:

import Button from '@my_name/UIComponents'

I dont want to adjust the imports everytime. The first thought that comes to mind is to develop the UIComponents inside node_modules folder but this seems not to be a nice solution.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

For solving this, try to use npm link. So instead of cloning it in a subdirectory that need to be added to gitignore, just check out the repository outside of you project and then link it.

Example:

cd ~/projects/UIComponents
npm link  
cd ~/projects/MyApp
npm link @my_name/UIComponents 

In this way you can use the same import syntax but you can develop locally in both projects at the same time without the need of publishing every change.

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