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

141
Views
📦 Bundle only required functions from npm package's javascript?

I don't want full luxon package as I'm only importing some functions from it.

// index.js
const luxon = require('luxon');

const end = luxon.DateTime.fromISO('2003-05-29');
const start = luxon.DateTime.fromISO('2022-05-03');
console.log(end.diff(start, ['years', 'months', 'days']).toObject());

How can I bundle only required functions (eg. DateTime, fromISO, diff) in index.min.js


Edit 1:

I tried esbuild, but it just bundle whole package

npx esbuild index.js --bundle --outfile=index.min.js
about 4 years ago · Juan Pablo Isaza
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!