This repository contains a boilerplate for building Chrome Extensions with React 18, TypeScript, and Vite 5. This boilerplate is inspired by and adapted from chrome-extension-boilerplate-react.
This is a basic Chrome Extensions boilerplate to help you write modular and modern Javascript code and load CSS easily. This boilerplate is using:
Please open up an issue to nudge me to keep the npm packages up-to-date.
- Check if your Node.js version is >= 18.
- Clone this repository.
- Change the package's
name
,description
, andrepository
fields inpackage.json
. - Change the name of your extension in
manifest.json
. - Run
yarn install
to install the dependencies. - Run
yarn build
- Load your extension on Chrome following:
- Access
chrome://extensions/
- Turn the
Developer mode
switch on (top right corner) - Click on
Load unpacked
- Select the
dist
folder.
- Access
- Happy hacking.
All your extension's code must be placed in the src
folder.
The boilerplate is already prepared to have a popup, a background script, and a content script. This example Chrome extension implements logic which lets the user scrape the page title. It was done so to demonstrate some of the chrome API functionality.
This boilerplate supports TypeScript! Everything that can be written in TypeScript is written in TypeScript.
This boilerplate has a watch script (yarn watch
) which will update the extension's code every time you save a file.
After the development of your extension run the command
$ yarn build
Now, the content of dist
folder will be the extension ready to be submitted to the Chrome Web Store. Just take a look
at the official guide to more infos about publishing.
Tomasz Kiljańczyk | Website