Sourcemap Explorer
Stack · npm package

preact

Fast 3kb React-compatible Virtual DOM library.

latest 10.29.8· MIT· 283 versions publishedView on npm

About

Fast 3kb React-compatible Virtual DOM library.

preactreactuiuser interfacevirtual domvdomcomponentsdom difffront-endframework

What detecting preact tells you about a site

preact is a 3 KB React-compatible alternative, so finding it tells you the team deliberately optimised for bundle size — often on a marketing site, an embeddable widget, or a performance-critical product where every kilobyte of JavaScript counts. Its presence usually means the same component model as React but with a hard eye on the download budget.

Why the exact preact version matters

Preact 10 aligned closely with the modern React API (hooks, `preact/compat`), so the exact version tells you whether the project can drop-in React libraries via the compat layer or is on an older, less-compatible line.

preact in a real-world stack

When you find preact in a bundle, it rarely travels alone. preact/compat to run React libraries, preact/signals for reactivity, and often a lightweight router rather than a full meta-framework.

Quick facts

Latest version10.29.8
LicenseMIT
Homepagepreactjs.com
Installnpm install preact
Direct dependencies0
Peer dependenciespreact-render-to-string

This package powers Preact

The preact package is the canonical implementation of Preact. Sourcemap Explorer uses this exact npm package as the framework-level fingerprint when it flags Preact on a page — both via the bundled node_modules/preact/ source paths and via the embedded package.json inside the JavaScript sourcemap.

Common pairings

Packages this one expects to find in the same project. Each is also a Sourcemap Explorer detection target.

preact-render-to-string

How Sourcemap Explorer detects preact

preact ships as v10.29.8, published 2026-08-01 and carries 0 direct dependencies, 1 peer dependency (preact-render-to-string), 283 versions on the registry. Those exact numbers are the footprint Sourcemap Explorer matches when preact rides inside a deployed bundle — here is how the detection works.

We catch preact from two complementary signals: bundled source paths and the embedded package.json. Modern bundlers (webpack, Vite, esbuild, Rollup, Turbopack) preserve the original node_modules/preact/ paths inside the JavaScript sourcemap's sources[] array — that's the canonical signal. When the matching package.json is also captured in sourcesContent[], we read the exact version field — patch number included. No regex guessing, no version inference.

  1. 1

    Confirm the site exposes sourcemaps

    In DevTools Network, check the response headers of any application script for `SourceMap` or `X-SourceMap`. Failing that, fetch the script's last 4 KB and look for a `//# sourceMappingURL=` comment — that map is where the `preact` paths live.

  2. 2

    Find the package in the bundle

    Open DevTools → Network → reload. Click any application script and look at its sourcemap. Inside, search `sources[]` for entries matching `node_modules/preact/` — every match confirms the package is bundled. The matching `sourcesContent[i]` for `node_modules/preact/package.json` gives you the exact installed version.

  3. 3

    Read the version directly from package.json

    Run `jq -r '. as $m | $m.sources | to_entries[] | select(.value | endswith("node_modules/preact/package.json")) | $m.sourcesContent[.key] | fromjson | .version' bundle.js.map`. Sourcemap Explorer automates the same query in the popup.

Major releases of preact

When each major version first landed. Major bumps are where breaking changes live, so this timeline is the fastest way to date the preact version a site actually ships against the ecosystem.

Major
First release
Date
v10
10.0.0
2019-10-01
v8
8.0.0
2017-04-06
v7
7.0.1
2016-11-10
v6
6.0.0
2016-08-25
v5
5.3.0
2016-07-17
v4
4.0.0
2016-02-23

Recent security advisories for preact

The 2 most recent advisories affecting some versions of preact, aggregated from OSV.dev (GitHub Advisory + CVE data). A listing here doesn't mean the version a given site ships is affected — each advisory applies to a specific version range. Sourcemap Explorer reads the exact bundled version so you can check it against these ranges.

  1. HIGHCVE-2026-22028· 2026-01-07

    Preact has JSON VNode Injection issue

  2. MODERATEGHSA-cg48-9hh2-x6mx· 2020-09-02

    HTML Injection in preact

Recent versions

Version
Released
10.29.8
2026-08-01
10.29.7
2026-07-08
10.29.6
2026-07-07
10.29.5
2026-07-07
10.29.4
2026-07-03
10.29.3
2026-06-26
10.29.2
2026-05-17
10.29.1
2026-04-03

preact README

Live mirror of the GitHub README, for reference. Updated whenever the repo's default branch changes.

[!NOTE] This is the branch for the upcoming release, for patches to v10 you need the v10.x branch

Preact

Fast 4kB alternative to React with the same modern API.

All the power of Virtual DOM components, without the overhead:

  • Familiar React API & patterns: ES6 Class, hooks, and Functional Components
  • Extensive React compatibility via a simple preact/compat alias
  • Everything you need: JSX, VDOM, DevTools, HMR, SSR.
  • Highly optimized diff algorithm and seamless hydration from Server Side Rendering
  • Supports all modern browsers
  • Transparent asynchronous rendering with a pluggable scheduler

💁 More information at the Preact Website ➞

npm Preact Slack Community OpenCollective Backers OpenCollective Sponsors

coveralls gzip size brotli size

You can find some awesome libraries in the awesome-preact list :sunglasses:


Getting Started

💁 Note: You don't need ES2015 to use Preact... but give it a try!

Tutorial: Building UI with Preact

With Preact, you create user interfaces by assembling trees of components and elements. Components are functions or classes that return a description of what their tree should output. These descriptions are typically written in JSX (shown underneath), or HTM which leverages standard JavaScript Tagged Templates. Both syntaxes can express trees of elements with "props" (similar to HTML attributes) and children.

To get started using Preact, first look at the render() function. This function accepts a tree description and creates the structure described. Next, it appends this structure to a parent DOM element provided as the second argument. Future calls to render() will reuse the existing tree and update it in-place in the DOM. Internally, render() will calculate the difference from previous outputted structures in an attempt to perform as few DOM operations as possible.

import { h, render } from 'preact';
// Tells babel to use h for JSX. It's better to configure this globally.
// See https://babeljs.io/docs/en/babel-plugin-transform-react-jsx#usage
// In tsconfig you can specify this with the jsxFactory
/** @jsx h */

// create our tree and append it to document.body:
render(
	<main>
		<h1>Hello</h1>
	</main>,
	document.body
);

// update the tree in-place:
render(
	<main>
		<h1>Hello World!</h1>
	</main>,
	document.body
);
// ^ this second invocation of render(...) will use a single DOM call to update the text of the <h1>

Hooray! render() has taken our structure and output a User Interface! This approach demonstrates a simple case, but would be difficult to use as an application grows in complexity. Each change would be forced to calculate the difference between the current and updated structure for the entire application. Components can help here – by dividing the User Interface into nested Components each can calculate their difference from their mounted point. Here's an example:

import { render, h } from 'preact';
import { useState } from 'preact/hooks';

/** @jsx h */

const App = () => {
	const [input, setInput] = useState('');

	return (
		<div>
			<p>Do you agree to the statement: "Preact is awesome"?</p>
			<input value={input} onInput={e => setInput(e.target.value)} />
		</div>
	);
};

render(<App />, document.body);

Sponsors

Become a sponsor and get your logo on our README on GitHub with a link to your site. [Become a sponsor]

            SentDM Songsterr Deno

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]


License

MIT

Preact

FAQ

What is preact used for?

Fast 3kb React-compatible Virtual DOM library.

How can I tell if a website is using preact?

Open the page in Chrome with the Sourcemap Explorer extension installed and read the Stack tab. We catch `preact` from two complementary signals: `node_modules/preact/` paths inside the JavaScript sourcemap, and the embedded `package.json` we read for exact-version detection. Without the extension you can do the same lookup manually in DevTools — the steps are listed in the "How Sourcemap Explorer detects" section above.

How do I find out which version of preact a website is running?

Read it straight from the site's JavaScript sourcemap. When a build ships source maps, the bundled `preact/package.json` carries the exact `version` string — Sourcemap Explorer extracts it in one click on the Stack tab, and you can do it by hand in DevTools by opening the `.map` file and searching for `node_modules/preact/package.json`. That is far more reliable than inferring the version from an asset-hash or a `?ver=` query string, which is all surface-level detectors have to go on. The current npm release is 10.29.8, but real deployments frequently run an older pinned version — which is exactly why reading the bundled number matters.

What is the latest version of preact?

10.29.8, as published on the npm registry. The "Recent versions" table on this page lists the most recent 8 releases with their release dates. Sourcemap Explorer reports the version actually bundled into a site, which can lag the latest release by months on real-world deployments.

Is preact actively maintained?

Very actively maintained — the last release shipped within the past three months. The last published release was 2026-08-01. Source code: https://github.com/preactjs/preact.

What is the relationship between preact and Preact?

preact is the canonical npm package for Preact. Sourcemap Explorer treats finding `preact` in a bundle as the framework-level signal that Preact is on the page, and the page you're reading is the canonical Sourcemap Explorer entry for the package itself.

Does preact have known security vulnerabilities?

2 recent advisories affecting some versions of preact are listed in the "Recent security advisories" section above, aggregated from OSV.dev (GitHub Advisory + CVE data). Whether a particular site is exposed depends entirely on the exact version it ships — each advisory applies to a specific version range, not to the package as a whole. That is why the precise bundled version matters: Sourcemap Explorer reads the version a site actually runs, so you can check it against the affected ranges instead of assuming the latest release is what's deployed.

Where can I read more?

Project homepage: https://preactjs.com. Source code: https://github.com/preactjs/preact. Published on npm: https://www.npmjs.com/package/preact. Licensed as MIT.

Keep reading on Sourcemap Explorer

Detected by Sourcemap Explorer

When a bundle ships sourcemaps, we read the embedded package.json for preact and report the precise version (the registry's latest is v10.29.8, published 2026-08-01; the bundled copy is often older). Without sourcemaps, an import / require in the page's scripts is enough to flag it.

Install free on Chrome