Note
This project is listed in the Awesome Vite
Tip
Share storage state between all pages
2024-07-20.12.36.15.mov
This boilerplate is made for creating chrome extensions using React and Typescript.
The focus was on improving the build speed and development experience with Vite(Rollup) & Turborepo.
- React18
- TypeScript
- Tailwindcss
- Vite
- Turborepo
- Prettier
- ESLint
- Chrome Extension Manifest Version 3
- Custom HMR(Hot Module Rebuild) Plugin
- Clone this repository.
- Change
extensionDescription
andextensionName
inmessages.json
file. - Install pnpm globally:
npm install -g pnpm
(check your node version >= 18.12.0) - Run
pnpm install
- Run:
- Dev:
pnpm dev
- When you run with Windows, you should run as administrator. (Issue#456)
- Prod:
pnpm build
- Dev:
- Open in browser -
chrome://extensions
- Check -
Developer mode
- Find and Click -
Load unpacked extension
- Select -
dist
folder at root
- Run:
- Dev:
pnpm dev:firefox
- Prod:
pnpm build:firefox
- Dev:
- Open in browser -
about:debugging#/runtime/this-firefox
- Find and Click -
Load Temporary Add-on...
- Select -
manifest.json
fromdist
folder at root
Remember in firefox you add plugin in temporary mode, that's mean it's disappear after close browser, you must do it again, on next launch.
Main app with background script, manifest
manifest.js
- manifest for chrome extensionlib/background
- background script for chrome extension (background.service_worker
in manifest.json)public/content.css
- content css for user's page injection
Some shared packages
dev-utils
- utils for chrome extension development (manifest-parser, logger)hmr
- custom HMR plugin for vite, injection script for reload/refresh, hmr dev-servershared
- shared code for entire project. (types, constants, custom hooks, components, etc.)tsconfig
- shared tsconfig for entire project.
content
- content script for chrome extension (content_scripts
in manifest.json)content-ui
- content script for render UI in user's page (content_scripts
in manifest.json)devtools
- devtools for chrome extension (devtools_page
in manifest.json)devtools-panel
- devtools panel for devtoolsnewtab
- new tab for chrome extension (chrome_url_overrides.newtab
in manifest.json)options
- options for chrome extension (options_page
in manifest.json)popup
- popup for chrome extension (action.default_popup
in manifest.json)sidepanel
- sidepanel(Chrome 114+) for chrome extension (side_panel.default_path
in manifest.json)
This Boilerplate is made possible thanks to all of its contributors.
Made by Jonghakseo