Building with esbuild?

esbuild failing or watch mode misbehaving? We unstick it.

esbuild is quick enough that teams forget it is still a compiler with opinions. Decorators need the right target, JSX factories need to match the runtime, and watch mode will not rebuild files it never saw. We trace the loader map, the tsconfig overlap and the plugin graph until the output is stable and the build is honest.

  • Since 2015Fixing technology
  • FreeEstimates
  • US teamReal engineers

esbuild.log

still failing

What it is

esbuild at a glance

esbuild is a JavaScript bundler and minifier written in Go by Evan Wallace, first released in 2020. It compiles, bundles, minifies and type-strips TypeScript roughly an order of magnitude faster than the JavaScript-based tools that came before it, which is why so many modern dev tools quietly ship esbuild inside them.

It is used directly as a build tool and also as the fast path inside Vite, Next.js, tsup, estrella and many others. The tool supports a JS and Go API, a CLI, incremental and watch builds, a modest plugin system, and a serve mode for local development. It is open source under the MIT license.

Type
JavaScript and TypeScript bundler, minifier, transformer
First released
2020
License
MIT, open source
Maintained by
Evan Wallace and contributors
Typically used for
Bundling TypeScript and JavaScript, powering faster dev servers, library builds, serverless packaging

The honest version

esbuild pros and cons

No technology is all upside. This is where esbuild earns its place and where it tends to cause trouble.

Where esbuild is strong

  • Genuinely fastA bundle that took forty seconds on Webpack lands in two on esbuild. For large apps, that difference reshapes how the team works, not just how long CI runs.
  • TypeScript as a first-class inputTypes are stripped, not checked, but syntax support is complete and the loader costs nothing extra to configure. tsc stays in the pipeline for type checking only.
  • Minification is production-gradeThe built-in minifier competes with Terser on size and crushes it on speed, which makes the production build cheap enough to run on every push.
  • Small, honest plugin APIPlugins are intentionally limited to resolve and load hooks, which keeps the pipeline predictable and the ecosystem from drifting into chaos.
  • Great for serverless packagingA single Lambda function bundles in under a second with tree-shaking and sourcemaps, which fits inside a cold start budget other tools cannot.
  • Works as a library or a CLIThe Go binary, the Node API and the browser build all expose the same options, so one config shape works across environments.

Where esbuild bites

  • Type checking is explicitly not includedesbuild strips types and keeps going. If tsc is not wired into CI alongside it, a type error ships to production and nobody notices until a user hits it.
  • Decorators lag the TypeScript compilerLegacy experimentalDecorators plus emitDecoratorMetadata, used by NestJS and TypeORM, still trips esbuild on common targets. Workarounds exist, none of them obvious.
  • Plugin API is deliberately narrowAnything that needs to rewrite a whole AST or intercept chunking is better off on Rollup, Vite or Webpack. esbuild will not grow to match them.
  • Dynamic requires are not bundledA dependency that does require(variable) ships a warning and keeps the call live at runtime, which quietly breaks serverless deploys that expected everything inlined.
  • Watch mode can miss files outside the entry graphChanges to assets or re-exports that esbuild never traced do not trigger a rebuild. The silence looks like it is working, and it is not.
  • Error messages focus on speed over contextA resolution failure gives you a file and a column and little else. For a buried monorepo path that is not enough to find the cause without more digging.

Sound familiar?

Common esbuild problems we fix

The esbuild problems that bring people to us, and what you have once each one is fixed.

Could not resolve "./utils"

An import will not resolve

A missing extension that esbuild respects where Node forgives, a TypeScript path alias that was never translated, or a workspace package whose exports map excludes the specific subpath being imported.

Resolution working across the graph

Transforming decorators to es2020 is not supported

Decorators refuse to compile

A NestJS or TypeORM codebase using legacy decorators and metadata, running through esbuild on a target it cannot emit yet. Either the TS compiler handles that layer or a plugin fills the gap.

Decorators emitting, metadata preserved

No loader is configured for ".vue"

A file type has no loader

An SFC framework file, an SVG as a component, or a CSS module hitting esbuild without the loader entry or a plugin that knows what to do with it.

Loaders mapped for every extension

Top-level await not supported with cjs

Top-level await breaks the output format

An ESM feature being emitted into a CommonJS target, usually because the output format was pinned for legacy consumers while the source assumed modern semantics.

Output format and source aligned

Dynamic require of "fs" is not supported

A dependency does runtime require()

A library that resolves module names from variables at runtime, typically for optional dependencies. The symptom in production is a missing module that your IDE and your tests never see.

Dynamic requires either bundled or externalized

@jsxRuntime pragma mismatch

JSX factory settings conflict

A file-level pragma disagreeing with the project-level jsx option, or a mixed React 17 and 18 setup where some files expect automatic and others classic.

JSX runtime consistent across the tree

watch build finished, 1 error

Watch mode misses the real change

A file re-exported through a barrel that esbuild never traced, or an asset outside the entry graph that other tools would have watched by convention.

Watch sees every file that matters

Cannot use "require" in an ES module

Mixed module systems break the bundle

A source file marked ESM through package.json still calling require(), or a dependency pulled in with the wrong condition from its exports map.

Module systems picked deliberately

What we do

esbuild help, from one broken flag to the whole pipeline

Ping us about a single transform error, or let us handle the entire esbuild setup end to end.

Rescue
A build that errors, a package that will not resolve, or a watch loop that silently stopped firing. We get the output honest first and write up the cause second.
Decorator and TypeScript setup
Legacy decorators, metadata emit, path aliases and strict tsc checks wired alongside esbuild so types are enforced while the bundler stays fast.
Serverless packaging
Lambda, Workers and Edge function bundles tuned for size and cold-start budget, with sourcemaps that still work when something crashes at 03:00.
Plugin work
Custom resolve and load hooks for internal module layouts, asset pipelines and bespoke virtual modules, written so the next upgrade does not need a rewrite.
Build migrations
Moving off Webpack, Rollup or Gulp onto esbuild where the trade-offs make sense, and keeping the ones where they do not.
Managed Tech
Dependency updates, build time monitoring, output size review, and an engineer on hand when an esbuild minor release changes a default.

How it works

From first message to fixed

  1. Look Free estimate

    Tell us what's going wrong. We look at it, then tell you plainly what's wrong and what it will cost.

  2. Fix

    We fix the cause, not the symptom. If something is down, getting it back up comes first.

  3. Harden

    Backups, monitoring, updates and access, so the same problem can't quietly come back.

  4. Hand back or stay on

    You get a plain-language write-up. Or we stay on for hosting, upkeep and new work.

Often found together

Running esbuild alongside something else?

We work on the whole stack, so the problem can be wherever it actually is.

Questions

esbuild questions

Something else? Call+1 737 727 7327

Is esbuild a drop-in replacement for Webpack?

Not quite. For many codebases it is close enough that the migration pays for itself within a week, but apps that rely on Webpack-specific loaders, Module Federation or deeply custom chunking will need rework. We assess the config, flag the gaps, and only recommend the swap when the win is real.

Why does esbuild not type-check?

By design. The tool strips types for speed and leaves type checking to tsc, which can run in parallel or in CI. If your current pipeline relies on the bundler to catch type errors, the fix is to add tsc --noEmit as its own CI step rather than to try to force esbuild into a role it rejects.

How do we handle decorators with esbuild?

For legacy experimentalDecorators, keep tsc in the chain and feed esbuild the compiled JavaScript, or use a plugin that applies the decorator transform before esbuild emits. For TC39 stage 3 decorators, modern esbuild supports them directly once the target is high enough.

Why does watch mode miss some file changes?

esbuild only watches files it actually reached while building. Assets that were copied by another step, templates referenced at runtime, or re-exports behind a plugin can fall outside the graph. We add an explicit watch set or move those pieces inside the entry so the rebuild fires.

Should we use esbuild for libraries or stick with Rollup?

For most applications and serverless bundles, esbuild. For published libraries that other builds will tree-shake, Rollup still produces cleaner, smaller output and a better module graph. A monorepo can run both, one per package, without stepping on itself.

How much does esbuild help cost?

The quote is free. Send over the build script, the config and the current error output, and a price comes back before any engineering begins.

Free estimate

esbuild giving you trouble?

Share the config, the loaders and the error. A human answers with a quote and a plan, and work only starts once you sign off.

  • No charge to find out what it will take
  • If it's urgent, say so

Replies come from a person. By sending, you authorize us to email you back. No marketing.