Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

158
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda