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

163
Views
Generate new used JS file using Puppeteer

I'm trying to improve the load times on some sites by creating new JS files containing only the ATF code, using Puppeteer.

I've done this for CSS already but the same code doesnt work for JS as its deleting some parent wrappers but keeping the code inside so the format comes out all wrong.

Is there a specific flag I can use with Puppeteer or some additional checks I can add to the code in order to prevent this?

Any help is appreciated.

//map over array, check and add new text to var
js_coverage.map(e => {
    if(e.url.includes('20210728')){
        for(const range of e.ranges){
            covered_js += e.text.slice(range.start, range.end) + "\n";
        }
        // console.log(e);
    }
})

//write new text to new .js file 
fs.writeFile("./exported_js.js", covered_js, function(err){
    if(err){
        return console.log(err);
    }
    console.log("JS Exported BOI!")
})
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!