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

132
Vistas
Esbuild & Typescript namespaces merge into bundle not working

I have following code. I want use single namespace Namespace1 for classes, but I don't know how to merge then without module imports. I think that if everything works in both the IDE and TS (npx tsc), there should be no problem in bundling. if I use modules, the composition in TS is not correct. Type detections, such as someMethod (in: Namesace1.Class1), do not work.

I bundle everything in esbuild. Is there a way to do this? It's possible to merge necessary files into bundle without import? Is it possible that this is an esbuild error?

class1.ts:

namespace Namespace1 {
    export class Class1 {
    }
}

class2.ts:

namespace Namespace1 {
    export class Class2 {
    }
}

index.ts:

let class1 = new Namespace1.Class1();
console.log(class1);

let class2 = new Namespace1.Class2();
console.log(class2);

In IDE(Visual studio) and TSC check is ok, but result bundle look like this - class definition totaly missing:

(() => {
  // src/index.tsx
  var class1 = new Namespace1.Class1();
  console.log(class1);
  var class2 = new Namespace1.Class2();
  console.log(class2);
})();
//# sourceMappingURL=index.js.map
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