This template helps you quickly start developing Chrome extensions with React, TypeScript and Vite. It includes the CRXJS Vite plugin for seamless Chrome extension development.
- React with TypeScript
- TypeScript support
- Vite build tool
- CRXJS Vite plugin integration
- Chrome extension manifest configuration
- Install dependencies:
npm install- Start development server:
npm run dev-
Open Chrome and navigate to
chrome://extensions/, enable "Developer mode", and load the unpacked extension from thedistdirectory. -
Build for production:
npm run buildsrc/popup/- Extension popup UIsrc/content/- Content scriptsmanifest.config.ts- Chrome extension manifest configuration
- Use
manifest.config.tsto configure your extension - The CRXJS plugin automatically handles manifest generation
- Content scripts should be placed in
src/content/ - Popup UI should be placed in
src/popup/
This project integrates Clerk for authentication in the popup, sidepanel, and options pages using @clerk/chrome-extension.
Setup:
- Install deps (already added):
@clerk/chrome-extension
- Create a Clerk application and copy your Publishable Key.
- Expose the key to Vite via an env var named
VITE_CLERK_PUBLISHABLE_KEY.
On Windows PowerShell:
$env:VITE_CLERK_PUBLISHABLE_KEY="pk_test_xxx"
npm run devOn Unix shells:
VITE_CLERK_PUBLISHABLE_KEY=pk_test_xxx npm run devThe UI will show a "Log in" button in the sidepanel and Glossary settings when signed out, and a UserButton when signed in. Sign-in is opened in a popup.