Create cross-browser extensions with no build configuration.
npm install extension[npm-version-image]: https://img.shields.io/npm/v/extension.svg?color=0971fe
[npm-version-url]: https://www.npmjs.com/package/extension
[npm-downloads-image]: https://img.shields.io/npm/dm/extension.svg?color=0971fe
[npm-downloads-url]: https://www.npmjs.com/package/extension
[action-image]: https://github.com/extension-js/extension.js/actions/workflows/ci.yml/badge.svg?branch=main&color=0971fe
[action-url]: https://github.com/extension-js/extension.js/actions
[discord-image]: https://img.shields.io/discord/1253608412890271755?label=Discord&logo=discord&style=flat&color=0971fe
[discord-url]: https://discord.gg/v9h2RgeTSN
[snyk-image]: https://snyk.io/test/github/extension-js/extension/badge.svg?color=0971fe
[snyk-url]: https://snyk.io/test/github/extension-js/extension
[![Version][npm-version-image]][npm-version-url] [![Downloads][npm-downloads-image]][npm-downloads-url] [![CI][action-image]][action-url] [![Discord][discord-image]][discord-url]
> The cross-browser extension framework
- Create a new extension — How to create a new extension.
- Watch demo — See how creating a new extension works.
- Start from an example — Start from a working baseline.
- I have an extension — Use only specific parts of Extension.js.
Create cross-browser extensions without manual build configuration.
Use Extension.js to develop, build, and preview across browsers with a unified workflow.
Use the create command to generate a new extension. Also works with pnpm, yarn, and bun.
``bash`
npx extension@latest create my-extension
cd my-extension
npm run dev
| |
|
|
|
|
|
|
| :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: |
| ESNext
Try out | TypeScript
Try out | WASM
(soon) | React
Try out | Vue
Try out | Svelte
Try out | Preact
Try out |
Get started from a sample
Start developing an extension using a sample from Chrome Extension Samples
See the example below where we request the sample page-redder from Google Chrome Extension Samples.
`bash`
npx extension@latest dev https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/functional-samples/sample.page-redder --browser=edge
If you have an existing extension which is using a package manager, you can install the Extension.js package and manually create the scripts used to run your extension.
Step 1 - Install extension as a devDependency
`bash`
npm install extension@latest --save-dev
Step 2 - Link your npm scripts with the executable Extension.js commands
`json`
{
"scripts": {
"build": "extension build",
"dev": "extension dev",
"preview": "extension preview"
},
"devDependencies": {
// ...other dependencies
"extension": "latest"
}
}
Done. You are all set!
- To develop the extension, run npm run dev.npm run build
- To build the extension in production mode, run .npm run build
- To visualize the extension in production mode, run and npm run preview.
| |
|
|
|
|
|
| :---------------------------------------------------------------------------: | :-------------------------------------------------------------------------: | :----------------------------------------------------------------------------: | :---------------------------------------------------------------------------: | :-----------------------------------------------------------------------------: | :----------------------------------------------------------------------------: |
| Chrome browser
✅ | Edge browser
✅ | Firefox browser
✅ | Safari browser
(soon) | Chromium-based
✅ | Gecko-based
✅ |
Use these flags with extension dev, extension start, or extension preview:
- Select a browser: --browser --chromium-binary
- Custom Chromium binary: --gecko-binary
- Custom Gecko (Firefox) binary:
Examples:
`bashChrome (system default)
npx extension@latest dev --browser=chrome
MIT (c) Cezar Augusto and the Extension.js Authors.