Debdut / browser-extension

Browser Extension Template with ESbuild builds, support for React, Preact, Typescript, Tailwind, Manifest V3/V2 support and multi browser build including Chrome, Firefox, Safari, Edge, Brave.
MIT License
677 stars 51 forks source link
boilerplate chrome-extension postcss preact starter starter-kit template

Browser Extension Template

w/ React Preact Typescript ESBuild

Generic badge

Browser Extension Template with ESbuild builds, support for React, Preact, Typescript, Tailwind, Manifest V3/V2 support and multi browser build including Chrome, Firefox, Safari, Edge, Brave.

Builtin

# 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

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. ESBuild makes sure the builds and reloads are really fast.

See browser support below.

Supports

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

Scripts & Pages (located in src/pages):

Just delete the folders of pages you don't require, the builds scripts detects automatically what's in there and adjusts the manifest automatically.

Browsers:

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.

In each of the pages folder, the target main script is the first of

Put your injecting scripts in public directory that needs to imported via the chrome.runtime.getURL API.

Credits

V2 wouldn't have been possible without my brilliant friend Sayan Naskar, the more credit we give him is less!