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
Use alias with URL for import.meta.url

I have two modules: client and processor.

  • The client module is for the web browser window this contains a module that can be used in the browser window.
  • The processor module is a web worker that contains the code to do web worker work.

In my client I trigger the web worker like this:

export class WebWorker {
  constructor() {
    const url = new URL('../../processor/src/worker.ts', import.meta.url);
    this.worker = new Worker(url);
  }
}

Is there a way for me to load the URL string using an import/alias so I would do something like this:

const url = new URL('@org/processor/worker.ts', import.meta.url);

I would like to do this so I can decouple the two modules, currently as it is, if it cannot find the url it throws an error.

I have something similar in my package.json

{
  "dependencies": {
    "@org/processor": "file:./path/to/processor",
  }
}
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!