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

183
Visualizações
Is there a way to include only one module in the bundle?

I'm building a microservice backend with lerna, parcel and docker. I have multiple microservices, which each rely on some common code in a “commons” package in the monorepo.

This commons package is never published to NPM. Therefore, it works fine in development, but as soon as I try to build the docker containers, the commons module is not available inside the containers.

Is there some way to tell parcel to externalize all dependencies (like it does by default on nodejs) except for the commons package? Is this possible?

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

0

You can mark a particular package for inclusion in the bundle by using the includeNodeModules option. For example, In the package.json of the project that you want output a bundle that includes commons package rather than simply referencing it, you would have:

{
   "main": "dist/index.js" // Or wherever you want to put the bundle.
   "targets": {
    "main": {
      "includeNodeModules": ["commons"]
    }
  }
}

For bundles that target nodejs (e.g. "library" packages), this option is false by default for every dependency (e.g. all dependencies will be "externalized" except what you put in this list - exactly what you asked for above).

(This assumes you are using Parcel 2+ - make sure you are referencing "parcel": "^2.0.1" not parcel-bundler (which is the deprecated v1 version)).

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