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

112
Views
Importing inside a module web worker

I have an index.html file that has a script tag with type="module".

Inside this script tag, I create a simple module worker like so

    // index.html
    let processFrameWorker = new Worker("/parent/worker.js", { type: "module" });
    processFrameWorker.addEventListener('message', (event) => {
        console.table("Event", event)
        console.log("back from worker")
    })
    processFrameWorker.postMessage('Some message');

and inside my worker I have

   // worker.js
   import sayHello from "/greeting.js"
   onmessage = function (e) {
       console.log('Worker: Message received from main script');
       postMessage(sayHello());
   }

I keep coming across this error enter image description here

which points to the first line (importation line) of the worker. I am completely out of things to try on how to fix this issue. I would appreciate any help.

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!