More Premium Hugo Themes Premium React Themes

Web Ext React Template

Template for a browser extension with React + TypeScript + esbuild

Web Ext React Template

Template for a browser extension with React + TypeScript + esbuild

Author Avatar Theme by hiterm
Github Stars Github Stars: 11
Last Commit Last Commit: Nov 18, 2022 -
First Commit Created: Jun 19, 2023 -
Web Ext React Template screenshot

Overview:

This article provides a guide on how to build a browser extension using React, TypeScript, and esbuild. It supports both Firefox and Chrome browsers. The article covers the basic usage, installation instructions, and customization options for the browser extension.

Features:

  • Build a browser extension with React + TypeScript + esbuild.
  • Supports both Firefox and Chrome browsers.
  • Provides basic usage examples and instructions.
  • Allows customization options for add-on ID and other settings.

Installation:

Build for Firefox:

  1. Enable watch mode: yarn watch
  2. Enable source map: yarn build --sourcemap

Build for Chrome:

  1. Build for both browsers: yarn build

Run with browsers:

Firefox:

  • Load the “web-ext” tool: yarn global add web-ext
  • Run the extension in Firefox: web-ext run --browser firefox

Chrome:

  • Load the extension in Chrome:
    • Open Chrome and type chrome://extensions in the address bar.
    • Enable “Developer mode” using the toggle switch.
    • Click on “Load unpacked” and select the extension folder.

Create a package for Firefox (zip):

To install an unsigned add-on, follow these steps:

  1. Use Firefox Developer Edition.
  2. Change the settings to allow unsigned add-ons.

Type check:

  • Run type checking using ESLint: yarn lint

Fix Prettier:

  • Fix code formatting using Prettier: yarn format

Customization:

To change the add-on ID for Firefox, follow these steps:

  1. Edit firefox.json.
  2. Update the ID to match the required format: {<UUID>}<alphanum>@<alphanum>

Summary:

This article provides a comprehensive guide on building a browser extension using React, TypeScript, and esbuild. It covers the basic usage, installation, and customization options for both Firefox and Chrome browsers. The provided code snippets and instructions make it easy to follow along and build a browser extension with the desired features.