Quickly start building a browser extension with React, TypeScript and webpack HMR!
Easy template for getting started building extensions configured for React, TypeScript, and webpack hot reloading.
Currently tested and working with Chrome
Note: HMR does not work for Content / Background scripts, you must restart browser to trigger Content / Background script updates
-
Fork & clone this repo
git clone https://github.com/[your-git-handle]/extension-template.git
-
Install node modules
npm i
-
Start dev server & build dev bundle
npm run dev
-
In Chrome, navigate to the URL
chrome://extensions/
-
Enable
Developer mode
on the top-right of page
-
Click
Load unpacked
and navigate to the/dev
bundle that was created, upload that folder -
Enable your extension with the toggle button
- (Optional) pin your extension for easily toggling the main interface (
popup.html
in the dev bundle)
- Enjoy! Your extension should popup with Hello, world! when you toggle the icon
To trigger HMR for your .tsx components, you need to toggle your extension's popup window after you save your changes.
- HMR currently not functional with Background and Content scripts, looking into how to implement.