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

287
Views
How to get a lodash custom (reduced) build suitable for es modules import?

I mean for example:

lodash include=each,find,filter,map,some,debounce,defer,delay,throttle,uniq,assign,extend,merge,omit,without,findIndex,compact,replace,groupBy,max,uniqueId

When I try to import in es modules, I get a warning like this:

Bundled and transpiled successfully, but with warnings: The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten

Is there any option to have the same custom (reduced) build, but suitable to be imported in modules and then available through '_' as always?

Thank you

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You could create your own aggregating module in a local file...such as tools/lodash.js:

export { 
  each, find, filter, map, some, debounce, defer, delay, throttle,
  uniq, assign, extend, merge, omit, without, findIndex, compact, 
  replace, groupBy, max, uniqueId 
} from 'lodash';

Then when you wanted these tools you could add

import * as _ from './tools/lodash`;

If you don't like the import * as _ syntax, you could do a straight import in your aggregating module and then do an export default { each, find, ... };. That would allow you to do import _ from './tools/lodash';.

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!