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

489
Visualizações
Lerna with watch tasks - lerna run --parallel

I have three packages:

  • A, depends on C
  • B, depends on C
  • C

When using lerna run build, C builds before A and B (good!)

But when I start a watch task lerna run watch, C never completes and therefor A and B dont get watched.

Using lerna run watch --parallel starts A, B and C at the same time but A and B both throw error because they cant find the dist folder from C (which C just deleted before rebuilding).

Is there any way to start watch tasks but still keep the order of dependencies like run normally does? Or at least delay some others?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Update: Based on the comment, I think I now understand whats happening. If you have build dependencies, they should sit in the same thread not concurrent threads, i.e. they should sequentially build.

However, you can still try it.. using the --noClean option in your build, it will not remove the dist folders! Then your parallel build will run.


Three settings: I would configure/double check (you didn't list your package.json) , so that lerna knows what order to follow

  1. First get your list in correct order for your peerDependencies
  2. Put those in the devDependencies
  3. of a given leaf package.json,

...The globs defined are relative to the directory that lerna.json lives in, which is usually the repository root. The only restriction is that you can't directly nest package locations, but this is a restriction shared by "normal" npm packages as well. And so... leaf packages under packages/* is considered a "best-practice"

enter image description here

Finally the topological order will then be user by lerna run in the build you can force it to include the dependencies --include-dependencies / or --include-dependents flag as needed, like so


Workaround option 2: for now to get past you can do...

lerna run build --concurrency 1
over 4 years ago · Santiago Trujillo Relatório

0

In my understanding, your watch jobs in a and b are not watching the node modules, especially the c dependency injected, and that result of this behavior.

Maybe if you add those directories to your watch job, you could find an efficient workaround.

over 4 years ago · Santiago Trujillo 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