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

182
Views
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 answers
Answer question

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 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!