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

222
Views
Get Current Module Scope As Object Webpack

Is there a way to get the current module scope as an object (kind of like this inside a function)

export let num = 5;
export let str = "hello world";
export const set = (name, value) => moduleObj[name] = value;

It is worth mentioning that I don't want to add num and str to a registry object, or other boilerplate like that.

It does not seem to be possible in node (Access NodeJS module scope variables as object) However because webpack packs things into functions, this would normally work. Unforantly, webpack replaces this with undefined when it is top scope. Is there any way I could do this?

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!