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

132
Views
How can I configure webpack to include javascript classes that are include via appendChild?

I have some legacy code that import a bunch of js files using document.createElement('script'). I would like to configure webpack to detect all those files and include them into the bundle. Any suggestions about how can I do this?

The legacy code is importing hundreds of js files this way:

["window.js","eventHandler.js", and several others].forEach(filename => {
  const dom = document.createElement('script');
  dom.type = 'text/javascript';
  dom.src = base_path + filename;
  document.head.appendChild(dom);
});

Is there a way I can automatize webpack to detect this old type of import? I would like to avoid have to write manually all the requires since it is a lot of files.

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!