Skip to content

Latest commit

 

History

3,941 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extension.js Version Downloads CI Discord Best Practices

The cross-browser extension framework. Build for Chrome, Edge, Firefox, and Safari with no build config required.

Logo

npx extension@latest create my-extension
cd my-extension
npm run dev

Works with npm, pnpm, yarn, bun, and deno.

Using an AI coding agent? Point it at the docs so it reads the current commands and options.

The CLI itself runs on Node.js 22.12+, Deno 2.5+, and Bun 1.2+.

Documentation · Templates · YouTube · Showcase · Blog

Why Extension.js

Browser extensions ship with the worst dev experience in modern web. Manifest V3 fragmentation, browser-specific quirks, no hot reload for content scripts, and a separate build pipeline for every target. Extension.js fixes that.

  • Hot Module Replacement for popup, options, devtools and other extension pages, including React, Vue, Svelte, and Preact components, with targeted reloads for content scripts and the service worker so one save never reloads the whole extension
  • Manifest V3 by default, with automatic adapters for Chrome, Edge, Firefox, and Safari targets
  • One CLI for Chrome, Edge, Firefox, Safari, and any Chromium or Gecko binary
  • Zero config, no webpack, no rollup, no plugins to maintain
  • First-class TypeScript, React, Vue, Svelte, and Preact support
  • Production builds with extension build --zip, ready for the Chrome Web Store, Edge Add-ons and Firefox Add-ons, and a Safari app built through Xcode on macOS
  • Drop-in for existing extensions with one devDependency

Watch it work

One command, and the extension is running in a real browser

How is this different

If you have used Plasmo, WXT, or CRXJS, here is what Extension.js does that the others do not:

Capability Extension.js
Run any GitHub sample directly extension dev https://github.com/.../sample
Managed browser binaries extension install firefox downloads an isolated build
Targeted content-script reload across browsers Built in, only the changed entries re-inject, no plugin glue
Production zip for the stores extension build --zip
Framework agnostic Vanilla, TS, React, Vue, Svelte, Preact, no lock-in
Custom Chromium and Gecko binaries --chromium-binary, --gecko-binary

Frameworks

ESNext TypeScript WASM React Vue Svelte Preact
ESNext
Try out
TypeScript
Try out
WASM
Try out
React
Try out
Vue
Try out
Svelte
Try out
Preact
Try out

Browsers

Use these flags with extension dev, extension start, or extension preview:

  • Select a browser: --browser <chrome | edge | firefox | safari>
  • Custom Chromium binary: --chromium-binary <path-to-binary>
  • Custom Gecko (Firefox) binary: --gecko-binary <path-to-binary>

Every browser picks its binary in the same order: the flag above, then chromiumBinary or geckoBinary in extension.config.js (under commands.<command>, then browser.<name>), then the browser's variable (CHROME_FOR_TESTING_PATH, CHROMIUM_BINARY, CHROME_BINARY, EDGE_BINARY or FIREFOX_BINARY), then the copy extension install downloaded, then the system install. A flag, config key or variable that names a path that does not exist stops the command, names the path and says which of the three pinned it.

# Chrome for Testing (the managed copy, offered on the first run)
npx extension@latest dev --browser=chrome

# Edge
npx extension@latest dev --browser=edge

# Safari, on macOS with Xcode
npx extension@latest dev --browser=safari

# Custom Chromium path
npx extension@latest dev --chromium-binary "/Applications/Chromium.app/Contents/MacOS/Chromium"

# Custom Firefox path
npx extension@latest dev --gecko-binary "/Applications/Firefox.app/Contents/MacOS/firefox"
Chrome Edge Firefox Safari Chromium Gecko
Google Chrome
✅ Supported
Microsoft Edge
✅ Supported
Mozilla Firefox
✅ Supported
Apple Safari
✅ Supported
Chromium-based
✅ Supported
Gecko-based
✅ Supported

The full guide to browsers, binaries and flags is in the browsers docs.

Ship to the store

Build a production-ready bundle and zip it for submission to the Chrome Web Store, Edge Add-ons, or Firefox AMO. A Safari build produces a macOS app through Xcode instead of a ZIP file:

# Production build
npx extension@latest build

# Production build packaged as a ZIP
npx extension@latest build --zip

# Per-browser builds
npx extension@latest build --browser=firefox --zip

# Safari app, on macOS with Xcode
npx extension@latest build --browser=safari

Useful flags:

  • --zip packages the build into a ZIP ready for store upload
  • --zip-source writes a second ZIP file of the source for store source-code review. When the build uses a workspace package, a file: dependency or a file outside the project folder, that ZIP file starts at the workspace root and carries them with the root package.json and lockfile, so a reviewer can install and build from it
  • --zip-source-include <globs> and --zip-source-exclude <globs> add files to the source ZIP file or keep files out of it, as comma-separated globs read from the project folder
  • --zip-filename <name> controls the output filename, written as dist/<name>-<browser>.zip. The tokens {name}, {version}, {versionName} and {browser} are filled from the manifest and the build
  • --zip-dir <path> writes the ZIP files to that folder instead of dist, relative to the project root or absolute
  • --source-maps writes a source map beside each script and stylesheet of a production build. The maps stay out of the ZIP file, and the build total counts them apart
  • --out-dir <path> writes the build to <path>/<browser> instead of dist/<browser>. A build into the folder a live dev session serves is refused, so this is how a build runs beside a dev session. extension dev --out-dir <path> moves the dev output the same way, and a dev session that replaces a production build says so first
  • --polyfill bundles the cross-browser webextension polyfill, off by default in every command. It is for a Chromium older than 148, or older than 152 when the manifest declares a devtools_page

The full guide, with store credentials and review notes, is in the publishing docs.

Manage browser binaries

Skip the system-install dance. Extension.js can download and manage isolated browser binaries for clean dev sessions:

# Install a managed Firefox build
npx extension@latest install firefox

# Install Chrome and Edge in one go
npx extension@latest install --browser=all

# Print where managed browsers live
npx extension@latest install --where

Every option is in the install command docs.

Add to an existing extension

Install Extension.js as a dev dependency and wire up your scripts.

npm install extension@latest --save-dev
{
  "scripts": {
    "build": "extension build",
    "dev": "extension dev",
    "preview": "extension preview"
  }
}

Run npm run dev to develop, and watch the browser open with your extension already loaded:

extension dev: the browser opens with the extension loaded

Use npm run build for production, and npm run preview to inspect the production output.

Start from a Chrome sample

Pull any sample from Chrome Extension Samples and run it directly:

npx extension@latest dev https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/functional-samples/sample.page-redder --browser=edge

Running a Chrome sample straight from its GitHub URL

Package managers

Add Extension.js to a project, or run it once without installing, with the package manager you already use.

Package manager Add to a project Run without installing
npm npm npm install extension@latest --save-dev npx extension@latest create my-extension
pnpm pnpm pnpm add extension@latest --save-dev pnpm dlx extension@latest create my-extension
Yarn Yarn yarn add extension@latest --dev yarn dlx extension@latest create my-extension (Yarn 2 or later. On Yarn 1, use npx)
Bun Bun bun add --dev extension@latest bunx extension@latest create my-extension
Deno Deno deno add npm:extension@latest deno run -A npm:extension@latest create my-extension

Which runtime the CLI then executes on is a separate question, answered below.

Runtimes

Runtime Status Notes
Node.js Node.js ✅ 22.12 and newer The default. npx, pnpm dlx, yarn dlx and bunx all land here through the published bin
Deno Deno ✅ 2.5 and newer deno run -A npm:extension@latest. Deno 2.8.0 is refused because it cannot load node:querystring, fixed in 2.8.1
Bun Bun ✅ 1.2 and newer bunx --bun extension and bun run --bun. Plain bunx runs the CLI on Node.js instead, through the published bin

Telemetry

Extension.js collects a tiny amount of anonymous telemetry to understand which commands are used and which fail, and never source code, file paths, URLs or project content. Turn it off with EXTENSION_TELEMETRY_DISABLED=1, DO_NOT_TRACK=1 or extension telemetry disable. The full list is in docs/TELEMETRY.md.

Community

  • Star the repo if Extension.js helped you ship faster
  • Join the Discord for help and feedback
  • Open issues and feature requests on GitHub
  • Browse production-ready templates

Sponsors

Sponsors help the project ship faster releases, better developer experience, and long-term reliability for extension teams.

Documentation is hosted by Mintlify through its open source program. Tiers and placement are listed in BACKERS.md.

Contributing

Bug reports and pull requests are welcome. Read docs/CONTRIBUTING.md for the dev setup, the test commands, and what a pull request needs to carry.

License

MIT (c) Cezar Augusto and the Extension.js authors.