Running Preact in production?

Preact compat or signals misbehaving? We ship it properly.

Preact is the 3kB answer to 'do we really need the whole React runtime', and most of the time it is a straight swap. The friction appears at the edges: a React library that assumes the full React internals breaks through preact/compat, a signal that updates without triggering the view, or SSR output that does not line up on hydration. We work through the aliases, the signal graph and the bundler config until the swap is invisible to users and painless for you.

  • Since 2015Fixing technology
  • FreeEstimates
  • US teamReal engineers

preact-build.log

still failing

What it is

Preact at a glance

Preact is a 3kB library that implements the same component model, hooks and JSX that React uses, with a different internal implementation designed for size and speed. It was created by Jason Miller in 2015 and is widely used where bundle size matters: documentation sites, embedded widgets, content-heavy marketing pages and performance-sensitive apps.

Through preact/compat, most React libraries work unchanged by aliasing react and react-dom at the bundler. Preact ships its own signals package for fine-grained reactivity, has a server-side renderer, and integrates with Vite, Next on the edge, Astro and Fresh. The project is open source under MIT and maintained by a small core team with a steady release cadence.

Type
Small React-compatible UI library
First released
2015 initial release
License
MIT, free and permissive
Maintained by
Jason Miller and the Preact core team
Typically used for
Small bundles, embedded widgets, marketing sites, documentation, performance-critical apps

The honest version

Preact pros and cons

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

Where Preact is strong

  • 3kB runtimeYou ship the component model, hooks and JSX in less than a tenth of what the full React runtime costs. On a marketing site that matters to Core Web Vitals.
  • Drop-in for most React codepreact/compat aliases React and React DOM at the bundler, which means most hooks-era libraries work unchanged. The migration is usually a config change, not a rewrite.
  • Signals for fine-grained updates@preact/signals avoid the re-render-the-world model when you want targeted reactivity, and the ergonomics are cleaner than useState in many cases.
  • SSR is fastPreact's server renderer produces HTML quickly, which matters for ISR-heavy sites and edge rendering where every millisecond ships in the TTFB.
  • Good tooling storyVite, Astro, Fresh and Next (on the edge) all support Preact out of the box, and Preact DevTools exist for in-browser debugging.

Where Preact bites

  • Compat shim is not 100%Libraries that reach into React internals, use experimental APIs or ship with a hardcoded dependency on specific React DOM versions will fail through preact/compat, and the failure mode is often cryptic.
  • Signals and hooks model the same thing twiceA codebase mixing useState, useReducer and signals ends up with two parallel reactivity systems. Teams need a convention or it gets confusing fast.
  • DevTools frictionReact DevTools work partially through the preact/compat bridge. The Preact profiler exists but has fewer features than React DevTools 5, which some teams miss.
  • Smaller ecosystemPreact-native components are fewer than React ones. Most of the time compat is enough; sometimes it is not, and you build.
  • SSR hydration still bitesJust like React, server-rendered markup that does not match client output produces hydration warnings, and in Preact the error messages are even less descriptive.
  • Alias misconfiguration is painfulForget to alias react-dom/client, or alias only half of the entries, and you get runtime errors deep inside a dependency. Tracking these down the first time is a bad afternoon.

Sound familiar?

Common Preact problems we fix

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

preact/compat: react-dom/client missing

Compat alias is incomplete

The bundler aliases react but not react-dom/client, or not react/jsx-runtime. A dependency that imports one of the missing paths explodes at runtime. We write the full alias block and the compat layer works end to end.

Every React import resolves through compat

signal updated but no re-render

Component ignores a signal update

The signal was read with .peek() inside render, which does not subscribe. Or the component is a React class that does not participate in the signals subscription model. We switch to .value and the component tracks the signal correctly.

Signals drive the view

Hydration mismatch on SSR

Markup differs between server and client

A date formatted with the local timezone, a window check, or a random id generated per render. We gate client-only logic behind useEffect or a mounted flag and the hydration becomes clean.

Hydration completes without warnings

forwardRef returned a function

forwardRef behaves differently than expected

Preact's forwardRef has slightly different ergonomics on older versions and some libraries rely on React's exact return shape. We upgrade preact/compat and adjust the component so refs land on the right node.

Refs pass through as intended

useSyncExternalStore not exported

A modern React hook is missing

An older preact/compat version did not expose every React 18 export. We upgrade to a current compat release and the missing hooks reappear.

Modern React libraries load

Invalid hook call outside tree

Two copies of Preact are loaded

A monorepo or a dependency ships its own preact, and the app has another, so hooks see two renderers. We dedupe through the bundler's resolve configuration and the hook graph collapses back to one.

Single Preact instance across the bundle

Preact profiler incompatible with React DevTools 5

DevTools do not show a useful tree

React DevTools 5 removed hooks the Preact bridge relied on. We install the dedicated Preact DevTools for the deep profile view, and leave React DevTools for quick checks.

Debug tooling works on both

What we do

Preact help, from quick fixes to full migrations

Hire us to unblock one broken alias, or let us run the whole Preact migration and upkeep.

Rescue
Hydration warnings, compat gaps and signal bugs diagnosed and fixed against a running app rather than a reproduction.
React to Preact migration
Alias map written, dependencies audited for compat support, build and SSR both verified, and bundle size measured before and after.
Signals adoption
A clean convention for when to use signals and when to use hooks, with the signal graph audited so updates land the way the design intended.
SSR and edge rendering
preact-render-to-string set up against Vite, Astro or Fresh, with hydration inspected on the real pages, not synthetic benchmarks.
Managed Tech
Dependency pinning as Preact and compat versions move, bundle size tracked over time, and a US engineer on retainer when a React library you depend on changes its internals.

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 Preact alongside something else?

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

Questions

Preact questions

Something else? Call+1 737 727 7327

Why is my React library not working through Preact compat?

Usually one of three reasons. The alias map is incomplete and a specific entry like react-dom/client or react/jsx-runtime is not redirected. The library reaches into React internals that Preact implements differently. Or two copies of Preact are loaded and the library sees a renderer it did not expect. We write the full alias block, upgrade compat to the current version, and dedupe the dependency tree.

Why did my signal update not re-render the component?

The most common cause is reading the signal with .peek() inside the render function, which deliberately does not subscribe. The second is reading .value inside a callback rather than the render body, which also does not subscribe. The third is a class component that does not participate in the signals subscription model. Switch to reading .value in the render body and the component tracks the signal as expected.

How much bundle size do we actually save with Preact?

Compared to React 18 plus React DOM, you save roughly 30 to 40 kB gzipped on a vanilla setup, which is enormous on a marketing site or an embedded widget. On a large app with many React libraries that pull in their own dependencies, the saving is smaller as a percentage but still material for Core Web Vitals.

Can Preact do server-side rendering like Next.js?

Yes, via preact-render-to-string, and frameworks like Astro and Fresh ship with first-class support. Next.js can use Preact on the edge runtime through aliases but it is less idiomatic. Hydration mismatches are the same category of problem they are in React, with slightly less descriptive error messages.

How much does Preact help cost?

The estimate is free. Describe the current stack, the target bundle size and the libraries you depend on, and a US engineer will come back with a scoped price and a migration plan before anything ships.

Free estimate

Preact giving you trouble?

Send over the bundler config and the failing component, and a US engineer will reply with a plan and a price.

  • 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.