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

129
Views
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
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!