A cross-browser extension template using Manifest V2 (MV2) with TypeScript and Webpack.
- Uses Manifest V2 for compatibility with legacy browsers.
- Supports TypeScript for better development experience.
- Bundles with Webpack for optimized output.
- Uses browser-polyfill.js for cross-browser support.
- Includes Husky for Git hooks integration.
- Supports Prettier for code formatting.
- Provides an easy build system with npm scripts.
Clone this repository and install dependencies:
git clone https://github.com/maanimis/cross-extension-template
cd cross-extension-template
npm install
To build the extension for production:
npm run build
This will compile TypeScript, bundle the scripts, and clean the dist/
folder.
- Go to
chrome://extensions/
(for Chrome) orabout:debugging#/runtime/this-firefox
(for Firefox). - Enable Developer Mode (Chrome) or click Load Temporary Add-on (Firefox).
- Click Load Unpacked and select the
build/
directory.
This extension is built with Manifest V2, which includes:
- browser_action: Defines a popup UI.
- background scripts: Includes
background.js
for persistent background tasks. - content scripts: Injects
content_script.js
into web pages. - permissions: Uses
storage
,activeTab
,webRequest
, and more.
This extension uses browser-polyfill.js, which provides a unified API across different browsers.
This project is licensed under the MIT License.