
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@fairfox/standalone-web
Advanced tools
A single, standalone version of Preact, HTM and Preact Signals. No external dependencies, just one single file.
A single, standalone version of Preact, HTM and Preact Signals. No external dependencies, just one single file.
Latest versions included:
Available as a single file for CDN usage or local vendoring.
<div id="app"></div>
<script type="module">
import {
html,
render,
signal,
Fragment
} from "https://esm.sh/@fairfox/standalone-web@1.0.4";
const count = signal(0);
function App() {
return html`
<Fragment>
<h1>Hello World!</h1>
<button onClick=${() => (count.value += 1)}>
Increment with signal
</button>
<p>Counter: ${count}</p>
</Fragment>
`;
}
render(html`<${App} />`, document.getElementById("app"));
</script>
When using TypeScript with esm.sh, type definitions are automatically provided:
import { html, render, signal, useSignal } from "https://esm.sh/@fairfox/standalone-web@1.0.4";
const count = signal<number>(0);
function Counter() {
const localCount = useSignal(0);
return html`
<div>
<p>Global: ${count}</p>
<p>Local: ${localCount}</p>
<button onClick=${() => localCount.value++}>+</button>
</div>
`;
}
For use with React component libraries:
<script type="module">
import {
html,
render,
signal,
Fragment,
memo,
forwardRef
} from "https://esm.sh/@fairfox/standalone-web@1.0.4/dist/standalone-web-react-compat.js";
// Now compatible with React ecosystem libraries
</script>
I don't recommend installing this package via NPM. It's best to install Preact, HTM and Preact Signals separately:
npm install preact htm @preact/signals
# or yarn
yarn add preact htm @preact/signals
# or pnpm
pnpm install preact htm @preact/signals
You can absolutely use separate packages via CDN (and it works fine):
<script type="module">
import { h, render } from "https://esm.sh/preact";
import htm from "https://esm.sh/htm";
import { signal } from "https://esm.sh/@preact/signals";
const html = htm.bind(h);
</script>
or use the combined HTM/Preact export:
<script type="module">
import { html, render } from "https://esm.sh/htm/preact";
import { signal } from "https://esm.sh/@preact/signals";
</script>
However, there are some situations where having either a single import is more convenient, or where one wants to vendor an already optimised build of these core components (eg for a browser extension).
Simply put, the ideal situation is:
<script type="module">
// Use via esm.sh CDN with automatic TypeScript support
import { html, render, signal } from "https://esm.sh/@fairfox/standalone-web@1.0.4";
// OR download locally for offline use
import { html, render, signal } from "./standalone-web.js";
</script>
All rights belong to Preact, HTM and Preact Signals owners/maintainers.
Install and bundle using Bun:
git clone https://github.com/alexjeffcott/standalone-web.git
cd standalone
bun install
bun run bundle # Creates dist files
dist/index.js - main bundle (23.8 KB minified)dist/compat.js - React compatibility version (30.5 KB minified)dist/index.d.ts - TypeScript definitionsdist/index.d.ts.map - maps for TypeScript definitionsdist/compat.d.ts - TypeScript definitions for compat versiondist/compat.d.ts.map - maps for TypeScript definitions for compat versionFAQs
A single, standalone version of Preact, HTM and Preact Signals. No external dependencies, just one single file.
We found that @fairfox/standalone-web demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.