This project demonstrates how to build a Chrome Extension using React and TypeScript. It includes examples of a Popup and a Content Script React app, both built and bundled with Vite and crxjs.
git clone [email protected]:yosevu/react-content-script.git
yarn
To start a development server with hot-reloading:
yarn dev
To create a production-ready build of the extension:
yarn build
- Navigate to chrome://extensions/
- Enable "Developer mode" using the toggle switch in the top right corner.
- Click the "Load unpacked" button in the top left corner.
- Select the
dist
directory inside thereact-content-script
directory. - Navigate to https://blank.org/ to see the Content Script React app in action.
- Open the extensions menu and click on "React TypeScript Chrome Extension" to see the Popup React app.
The popup source code is at the root directory.
The content script source code is in the content-script
directory.
- Live Reloading: Use
yarn dev
to see changes immediately during development. - Debugging: Use Chrome DevTools to inspect and debug both the content script and popup.
This repository was originally part of How to inject a React app into a Chrome Extension as a Content Script.
This project is licensed under the MIT License - see the LICENSE file for details.