Skip to content
/ browser-extension Public template
forked from Debdut/browser-extension

A Out of the Box 🎁 Browser Extension Template with support for React, Preact, Typescript and Manifest V3 and builds on most browsers including Chrome, Firefox, Safari, Edge, Brave.

License

Notifications You must be signed in to change notification settings

rt07x/browser-extension

 
 

Repository files navigation

Browser Extension Template Generic badge

w/ React Preact Typescript

Generic badge

An out of the box, Browser Extension Template with fast Vite builds, support for React, Preact, Typescript, Manifest V3/V2 support and multi browser build including Chrome, Firefox, Safari, Edge, Brave.

Builtin

  • Manifest v3/v2
  • Multi Browser build including Chrome, Firefox, Safari, Edge, Brave
  • Content Script
  • Background Page or Service Worker
  • Popup Page
  • Options Page
  • Devtools Page
  • Newtab Page
  • Automatically opens browser
  • Runs multiple browsers in parallel
  • Autoreloads browser
  • Saves browser profiles for next start

Start Commands

npm install
npm run start [browsers]
# example
# npm run start chrome firefox brave safari

That's it, if you got the browsers in the start command installed, it automatically builds for that, starts all of them, loads the extensions and reloads them on change. Vite makes sure the builds and reloads are really fast.

See browser support below.

Supports

  • Vite 3
  • React 18
  • Typescript
  • Preact X
  • PostCSS

Simply remove or don't use the technologies you don't like.

Scripts & Pages (located in src/pages):

  • background
  • content
  • history
  • options
  • popup
  • bookmarks
  • devtools
  • newtab
  • panel

Just delete the folders of pages you don't require, the builds scripts detects automatically what's in there and adjusts the manifest automatically. In each of the pages folder, the target main script is the first of

  • index.html
  • index.ts
  • index.tsx
  • index.js
  • index.jsx
  • main.html
  • main.ts
  • main.tsx
  • main.js
  • main.jsx

Browsers:

  • arc
  • brave
  • chrome
  • chrome-beta
  • chrome-canary
  • chromium
  • edge
  • firefox
  • firefox-developer-editon
  • firefox
  • opera
  • orion *
  • safari *
  • safari-beta *
  • safari-technical-preview *
  • sidekick
  • vivaldi

Browsers with * stars get a build, but needs to be launched manually, and extension needs to loaded manually with Xcode.

Notes

If you want webpack build, checkout the webpack branch.

Updates:

  • Webpack to Vite: 5x faster builds
  • Detects all browsers automatically
  • Automatic Manifest
  • All Extension Pages and Scripts Support
  • 17 browsers support

Commands

# Install packages
npm install


# Live Dev for multiple browsers
npm run start [browser]
# npm run start chrome firefox safari

# Build for multiple browsers
npm run build [browser]
# npm run build chrome firefox safari

# Clean Builds
npm run clean

About

A Out of the Box 🎁 Browser Extension Template with support for React, Preact, Typescript and Manifest V3 and builds on most browsers including Chrome, Firefox, Safari, Edge, Brave.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 85.4%
  • CSS 9.3%
  • HTML 4.4%
  • JavaScript 0.9%