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

351
Views
Rollup: Is it possible to prevent window.* pollution if a module has window.ejs = exports;

I am trying to make an ES6 module out of EJS. I managed! However, the source has this:

if (typeof window != 'undefined') {
  window.ejs = exports;
}

This means that the resulting module ALSO has that. Barring running a regex on the source file, is there a neat way of preventing the module from polluting window?

I made a reproduction replit for it: https://replit.com/@mercmobily/prevent-namespace-pollution#ejs-es.js The source is node_modules/ejs/lib/ejs.js which ends with:

/* istanbul ignore if */
if (typeof window != 'undefined') {
  window.ejs = exports;
}

And obviously so does the resulting ES6 module. I am in talks to the author of EJS who is happy to make minor changes, but not drastic ones.

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!