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

157
Views
Webpack pack to global scope? (For manifest v3 service worker)

Manifest v3 service workers require listeners are defined in the global scope of a file, webpack compiles to inside an anonymous function. These two things seems basically incompatible. Does anyone have a solution better than ditching webpack?

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

0

There's no such requirement, it's an incorrect/inaccurate claim in the documentation: "top level of your script" is a misrepresentation of the technical terms used to describe the JS engine internals.

The actual requirement is to register the listeners in the main (synchronous) phase of the first task of the JS event loop, which may certainly happen inside a function:

(() => {
  (() => {
    chrome.runtime.onMessage.addListener(msg => { /* ..... */ });
  })();
})();
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!