Softwr

Web Development · head to head

Preact vs esbuild

Preact logo

Preact

Web Development

3kB alternative to React with the same modern API

From
Free
Rated
-
esbuild logo

esbuild

Web Development

Extremely fast JavaScript bundler written in Go

From
Free
Rated
-

The short version

  • Each has a real cost: Preact compatibility through preact/compat is good but not total, and some React libraries break in ways that are hard to diagnose; esbuild deliberately does not type-check TypeScript, only strips types, so tsc still runs separately
  • They diverge on capability: Preact covers 3kB runtime, esbuild covers Very fast builds.

Where they differ

Only the attributes on which Preact and esbuild actually diverge.

Attributes where Preact and esbuild differ
AttributePreactesbuild
PlatformsWebLinux, macOS, Windows

Identical on both: starting price (Free), pricing model (Open source, no licence fee), free tier (Yes), user rating (Not yet rated), category (Web Development).

What each one covers

Drawn from each product's published feature list. An absence here means we hold no record of it - not that the product lacks it.

Only in Preact

  • 3kB runtime
  • preact/compat
  • Same modern API
  • Fast rendering

Only in esbuild

  • Very fast builds
  • TypeScript support
  • Tree shaking and minification
  • Simple API

What people use each for

The jobs each tool is most often brought in to do.

Preact

  • Embedded widgets that load inside someone else’s page and must stay smallnot esbuild
  • Marketing and content sites where JavaScript payload affects Core Web Vitalsnot esbuild
  • Applications targeting low-bandwidth or low-powered devicesnot esbuild

esbuild

  • Build pipelines where bundle time is the bottlenecknot Preact
  • Libraries and tools needing a fast, embeddable bundlernot Preact
  • Replacing slower bundlers where the plugin ecosystem is not needednot Preact

Where each one falls short

Documented limitations, not opinions. Every one is a constraint you would hit in normal use.

Preact

  • Compatibility through preact/compat is good but not total, and some React libraries break in ways that are hard to diagnose
  • Behavioural differences from React exist in edge cases, particularly around event handling
  • A much smaller community, so unusual problems have fewer existing answers than React

esbuild

  • Deliberately does not type-check TypeScript, only strips types, so tsc still runs separately
  • Plugin API is far narrower than webpack or Rollup, and complex builds hit its limits
  • Code splitting support has historically lagged the more established bundlers
  • Frequently used indirectly through Vite, so direct use is a narrower need than the download numbers suggest

Pricing, plan by plan

Preact

Free
  • PreactFree
    • Full library
    • Commercial use permitted
    • No usage limits

esbuild

Free
  • esbuildFree
    • Full functionality
    • Commercial use permitted
    • Community support

Which should you pick?

Choose Preact if

  • You need 3kb runtime.
  • You want to start without paying.
  • You also want preact/compat.

Choose esbuild if

  • You need very fast builds.
  • You want to start without paying.
  • You work on Linux, macOS, Windows.
  • You also want typescript support.

Questions people ask

Is Preact or esbuild better?
Neither clearly leads. Preact starts at Free and esbuild at Free, and user ratings are close enough to be indistinguishable. Choose on capability and platform support.
Which is cheaper, Preact or esbuild?
Preact starts at Free and esbuild at Free.
Does Preact or esbuild run on more platforms?
Preact runs on Web. esbuild runs on Linux, macOS, Windows.
Can I use Preact for free?
Both have a free tier, so you can try either at no cost before committing.
What is Preact best used for?
Preact is most often used for embedded widgets that load inside someone else’s page and must stay small, marketing and content sites where javascript payload affects core web vitals, applications targeting low-bandwidth or low-powered devices. Of those, embedded widgets that load inside someone else’s page and must stay small and marketing and content sites where javascript payload affects core web vitals are not what esbuild is typically brought in for.
What can Preact do that esbuild cannot?
Preact covers 3kB runtime, preact/compat, Same modern API, Fast rendering. esbuild covers Very fast builds, TypeScript support, Tree shaking and minification, Simple API.

Answered from the vendors’ own pages

Preact: Is Preact free?

Yes, open source under the MIT licence.

esbuild: Is esbuild free?

Yes, open source under the MIT licence.

Preact: Can I use React libraries with Preact?

Most, through the preact/compat layer. Compatibility is good but not complete, so libraries relying on React internals can break.

esbuild: Does esbuild type-check TypeScript?

No. It strips types for speed and does not check them. Run tsc separately if you need type checking.

Preact: Why choose Preact over React?

Bundle size, almost always. If payload is not a binding constraint, React’s ecosystem is usually the better trade.

esbuild: Do I need esbuild if I use Vite?

You already have it. Vite uses esbuild internally for dependency pre-bundling and transforms.

Share

Related pages

Other head to heads