Giter Club home page Giter Club logo

react-vite-webext's Introduction

WebExtension Vite Starter

A Vite powered WebExtension (Chrome, FireFox, etc.) starter template.

Made based on https://github.com/antfu/vitesse-webext, big thanks to @antfu!

Features

  • โšก๏ธ Instant HMR - use Vite on dev (no more refresh!)
  • ๐Ÿฆพ TypeScript - type safe
  • ๐Ÿ–ฅ Content Script - UseReact even in content script
  • ๐ŸŒ WebExtension - isomorphic extension for Chrome, Firefox, and others
  • ๐Ÿ“ƒ Dynamic manifest.json with full type support

Pre-packed

WebExtension Libraries

Coding Style

Dev tools

  • TypeScript
  • esno - TypeScript / ESNext node runtime powered by esbuild
  • npm-run-all - Run multiple npm-scripts in parallel or sequential
  • web-ext - Streamlined experience for developing web extensions

Use the Template

GitHub Template

Create a repo from this template on GitHub.

Clone to local

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

npx degit quolpr/react-vite-webext my-webext
cd my-webext
yarn

Usage

Folders

  • src - main source.
    • contentScript - scripts and components to be injected as content_script
    • background - scripts for background.
    • styles - styles shared in popup and options page
    • manifest.ts - manifest for the extension.
  • extension - extension package root.
    • assets - static assets.
    • dist - built files, also serve stub entry for Vite on development.
  • scripts - development and bundling helper scripts.

Development

yarn dev

Then load extension in browser with the extension/ folder.

For Firefox developers, you can run the following command instead:

yarn start:firefox

web-ext auto reload the extension when extension/ files changed.

While Vite handles HMR automatically in the most of the case, Extensions Reloader is still recommanded for cleaner hard reloading.

Build

To build the extension, run

yarn build

And then pack files under extension, you can upload extension.crx or extension.xpi to appropriate extension store.

Credits

This repo was made based on https://github.com/antfu/vitesse-webext

react-vite-webext's People

Contributors

antfu avatar tmkx avatar tshemeng avatar quolpr avatar andarist avatar wensonsmith avatar privatenumber avatar ntnyq 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.