This is a starter project for creating Chrome extensions with Vite, React, TypeScript and Tailwind CSS
This project is a starter template for building modern Chrome extensions using Vite, React, TypeScript, and Tailwind CSS. It simplifies the setup so you can focus on building your extension's features.
git clone https://github.com/omribarmats/chrome-extension-starter.git new-project
new-project
with your project namecd new-project
npm install
npm run dev
npm run build.
chrome://extensions/
in your Chrome browser.Developer mode
.Load unpacked
and select the dist
folder from the project.nmp run build
to implement changes to dist
folderchrome://extensions/
and click refresh ⟳
src/chrome-extension/popup/index.tsx
nmp run build
then visit chrome://extensions/
and click the refresh ⟳
button on your extensionGo on src/chrome-extension/options/index.tsx
Once changes are made open the terminal and run nmp run build
then visit chrome://extensions/
and click the refresh ⟳
button on your extension
Create a background.ts
file inside the src
folder
Go on vite.config.ts
and add this line background: resolve(__dirname, "src/background.ts"),
under build.rollupOptions.input
For example
build: {
rollupOptions: {
input: {
popup: resolve(__dirname, "popup.html"),
options: resolve(__dirname, "options.html"),
background: resolve(__dirname, "src/background.ts"),
},
output: {
entryFileNames: "[name].js",
},
},
},
manifest.json
and add this code: "background": {
"service_worker": "background.js",
"type": "module"
}
nmp run build
then visit chrome://extensions/
and click the refresh ⟳
button on your extensionFeel free to fork the project and make improvements or submit bug reports or issues.