Code Monkey home page Code Monkey logo

browser-extension-react-typescript-starter's Introduction


Browser Extension React & TypeScript Starter

Browser Extension
React & TypeScript Starter

A cross-platform (Chrome, Firefox, Edge, Opera, Brave) web browser extension (Manifest V3 and Manifest V2) starter kit with hot reload support, built with React, Typescript, Redux, Vite, ESLint, Prettier, TailwindCSS, Jest and more!


CI   PRs welcome   MIT License

Features · Quick Start · Important Notes · License

Features

  • Instant HMR (hot reload)1
  • Write once run on any browser
  • Global Redux support with persist option. Effortless communication between content, background, popup, options, and more pages.
  • Provides a basic content example and popup, options, and welcome pages with all React
  • Latest Manifest V3 support
  • Manifest V2 support (beta)
  • Dynamic manifest.json
  • Includes ESLint configured to work with TypeScript and Prettier
  • Includes tests with Jest

Built with

  • React
  • TypeScript
  • Redux (toolkit and redux-persist)
  • TailwindCSS
  • Vite
  • Jest
  • ESLint
  • Prettier
  • simple-git-hooks (lightweight husky alternative)
  • nano-staged

Browser Support

Chrome Firefox Edge Opera Brave
✔ (Beta)

Quick Start

Ensure you have

Use the Template

GitHub Template

Create a repo from this template on GitHub.

or

Clone to local

If you prefer to do it manually with the cleaner git history

Note If you don't have yarn installed, run: npm install -g yarn

npx degit sinanbekar/browser-extension-react-typescript-starter my-web-extension
cd my-web-extension
git init

Then run the following:

  • yarn install to install dependencies.

  • yarn dev to start the development server.

  • yarn build to build an unpacked extension.

  • Load extension in Chrome (Chromium, Manifest V3)

    • Go to the browser address bar and type chrome://extensions
    • Check the Developer Mode button to enable it.
    • Click on the Load Unpacked Extension button.
    • Select your dist folder in the project root.
  • Load extension in Firefox (Manifest V2)

    • Go to the browser address bar and type about://debugger
    • Click on the Load Temporary Add-on button.
    • Select your dist-firefox-v2 folder in the project root.

Available Commands

  • yarn clean to remove dist folder. dev and build commands call this command.
  • yarn format to fix code with eslint and prettier.
  • yarn lint to call ESLint and Prettier.
  • yarn test for testing.

Redux

You can use redux (redux-toolkit) as state manager between popup, background, content and custom pages. Read the documentation for more.

Bundling

Note This plugin powers the development side of this starter.

docs: https://crxjs.dev/vite-plugin

Special thanks to @jacksteamdev and contributors for this amazing plugin.

Contributing

This repository is following the Conventional Commits standard.

License

MIT © Sinan Bekar

Footnotes

  1. While it is fully supported and stable in most cases, hard reloading is rarely recommended.

browser-extension-react-typescript-starter's People

Contributors

renovate[bot] avatar sinanbekar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.