A TypeScript-based CLI for building Chrome Manifest V3 extensions with modern tooling. Scaffold production-ready Chrome extensions with sensible defaults, TypeScript support, and a modern build pipeline powered by Vite.
- π Quick project scaffolding with
createcommand - π¦ Manifest V3 generation and validation
- π§ Vite-powered build system with HMR
- π Browser Preview - Auto-launch Chrome with your extension loaded
- π Hot Module Replacement - See changes instantly without manual reload
- β TypeScript-first development experience
- π¨ Multiple templates: Vanilla JavaScript, React, and Vue (Svelte coming soon)
- π Comprehensive manifest validation with helpful error messages
- π Cross-platform support (Windows, macOS, Linux)
Install globally:
npm install -g extnOr use with npx (no installation required):
npx extn create my-extensionCreate a new Chrome extension in seconds:
# Create a new extension
extn create my-extension
# Navigate to the project
cd my-extension
# Install dependencies
npm install
# Start development with Browser Preview
npm run devThat's it! The npm run dev command will:
- β¨ Build your extension with Vite
- π Automatically launch Chrome with your extension loaded
- π§ Open DevTools for debugging
- π Auto-reload on file changes (HMR)
No more manual "Load unpacked" workflow - just code and see your changes instantly!
If you prefer to load the extension manually:
- Run
npm run buildto create thedistfolder - Open Chrome and navigate to
chrome://extensions - Enable "Developer mode" (toggle in top-right corner)
- Click "Load unpacked"
- Select the
distfolder from your project
Create a new Chrome extension project with a complete file structure, manifest, and build configuration.
Usage:
extn create my-extension
extn create my-extension --template vanilla
extn create my-extension --directory ./projectsOptions:
-t, --template <name>- Template to use (default:vanilla)vanilla- Plain JavaScript/TypeScript templatereact- React 19 with TypeScript and modern toolingvue- Vue 3 with TypeScript and Composition API
-d, --directory <path>- Target directory (default:./<project-name>)
Examples:
# Create with default settings (vanilla template)
extn create my-extension
# Create with React template
extn create my-extension --template react
# Create with Vue template
extn create my-extension --template vue
# Create in a specific directory
extn create my-extension --directory ~/projects
# Combine options
extn create my-react-extension --template react --directory ~/projectsWhat gets created:
my-extension/
βββ src/
β βββ popup/
β β βββ popup.html # Extension popup UI
β β βββ popup.js # Popup logic
β β βββ styles.css # Popup styles
β βββ background/
β β βββ background.js # Service worker
β βββ content/
β βββ content.js # Content script
βββ public/
β βββ icons/ # Extension icons (16, 48, 128)
βββ manifest.json # Chrome extension manifest (V3)
βββ package.json # Project dependencies
βββ vite.config.js # Vite configuration
βββ web-ext-config.mjs # Browser development configuration
βββ tsconfig.json # TypeScript configuration
Display the current version of extn.
extn --versionDisplay help information for all commands.
extn --help
extn create --helpProjects created with extn include:
- Manifest V3 - Valid Chrome extension manifest with all required fields
- Vite Build System - Fast development server with HMR and optimized production builds
- TypeScript Support - Full TypeScript configuration (optional to use)
- Example Code - Working popup, background service worker, and content script
- Icons - Placeholder icons in required sizes (16x16, 48x48, 128x128)
When using the React template (--template react), you also get:
- React 19 - Latest React with modern hooks and concurrent features
- TypeScript - Strict type checking for React components and Chrome APIs
- Modern JSX Transform - No need to import React in every file
- React Components - Example popup and content script as React components
- Error Boundaries - Built-in error handling for React components
- Testing Setup - Vitest with React Testing Library pre-configured
- Type Definitions - Full type support for Chrome extension APIs
When using the Vue template (--template vue), you also get:
- Vue 3 - Latest Vue with Composition API and
<script setup>syntax - TypeScript - Strict type checking for Vue components and Chrome APIs
- Single File Components - Vue SFC format with template, script, and style
- Vue Components - Example popup and content script as Vue components
- Hot Module Replacement - Instant updates during development
- Testing Setup - Vitest with Vue Test Utils pre-configured
- Type Definitions - Full type support for Chrome extension APIs
After creating a project:
# Install dependencies
npm install
# Start development with Browser Preview
npm run dev
# Build for production
npm run build
# Preview production build
npm run previewThe npm run dev command provides a complete development experience:
What happens:
- π¨ Vite builds your extension to
dist/ - π Chrome automatically launches with your extension loaded
- π§ DevTools open automatically for debugging
- π Browser navigates to
chrome://extensionsto show your extension
Features:
- β‘ Instant HMR - Changes to popup, options, and content scripts update without reload
- π Smart Reload - Manifest and background changes trigger full extension reload
- π DevTools Ready - Console and debugger open automatically
- π TypeScript Support - Full type checking during development
Customization:
Edit web-ext-config.mjs in your project to customize:
- Browser target (Chrome, Firefox, Edge)
- Profile location
- Start URLs
- Browser launch options
The npm run build command creates an optimized extension in the dist/ folder:
- π¦ Minified JavaScript bundles
- ποΈ Optimized assets
- β Validated manifest
- π Ready for Chrome Web Store submission
All templates generated by extn include Browser Preview features through a template inheritance system:
Base Template (Browser Preview)
βββ web-ext configuration
βββ dev script with auto-launch
βββ development workflow
β Extended by β
Vanilla Template React Template Vue Template
βββ Vite configuration βββ Vite + React config βββ Vite + Vue config
βββ Basic extension βββ React 19 + TypeScript βββ Vue 3 + TypeScript
βββ Vanilla JavaScript βββ Modern JSX transform βββ Composition API
βββ React components βββ Vue SFC components
(Svelte template coming soon - all will include Browser Preview)
What this means for you:
- π― Every template type gets Browser Preview automatically
- π§ Framework-specific features stay separate from dev workflow
- π¦ Consistent development experience across all templates
- βοΈ Choose your preferred framework (Vanilla, React or Vue)
- π Future templates will inherit Browser Preview features
Problem: Chrome shows "Manifest file is missing or unreadable"
Solution:
- Make sure you've run
npm run buildfirst - Load the
distfolder, not the project root - Check that
manifest.jsonexists in thedistfolder
Problem: Missing dependencies after creating a project
Solution:
cd your-project
npm installProblem: Clicking the extension icon does nothing
Solution:
- Check browser console for errors (F12)
- Verify
popup.htmlexists indist/src/popup/ - Check manifest.json has correct
action.default_popuppath - Reload the extension in
chrome://extensions
Problem: Content script doesn't run on web pages
Solution:
- Check
manifest.jsonhas correctcontent_scripts.matchespatterns - Verify the match pattern includes the test page URL
- Reload the extension and refresh the web page
- Check browser console for errors
Problem: Build fails with TypeScript type errors
Solution:
- Check
tsconfig.jsonconfiguration - Run
npm installto ensure all type definitions are installed - Verify all imports use correct paths
- Check for syntax errors in
.tsfiles
Problem: Cannot create project directory
Solution:
- Check you have write permissions in the target directory
- Try running with appropriate permissions
- Specify a different directory with
--directoryflag
Problem: npm run dev fails or port is in use
Solution:
- Check if another process is using port 5173
- Kill the process or specify a different port in
vite.config.js - Check for syntax errors in
vite.config.js
Problem: npm run dev builds successfully but browser doesn't open
Solution:
- Ensure Chrome/Chromium is installed on your system
- Check that
web-extcan find your browser binary - Try specifying a custom browser path in
web-ext-config.mjs - On Linux, ensure Chrome is in your PATH
Problem: File changes don't trigger extension reload
Solution:
- Check that Vite dev server is running (should see output in terminal)
- Verify the file you're editing is in the
src/directory - For manifest changes, expect a full extension reload (not HMR)
- Check browser console for HMR connection errors
Problem: Extension state is lost between sessions
Solution:
- Restart the dev server (
npm run dev) - Check the browser console for errors
- Try rebuilding:
npm run build && npm run dev
For maintainers:
- Quick Start: 3-minute setup guide
- Full Guide: Complete release documentation
- Setup Details: Configuration reference
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Clone your fork:
git clone https://github.com/your-username/extn.git - Install dependencies:
npm install - Create a branch:
git checkout -b feature/your-feature
# Install dependencies
npm install
# Build TypeScript
npm run build
# Link for local testing
npm link
# Run tests
npm test
# Run tests in watch mode
npm run test:watch
# Check coverage
npm run test:coverage
# Lint code
npm run lint
# Format code
npm run format# Build the CLI
npm run build
# Test the create command
npm link
extn create test-extension
cd test-extension
npm install
npm run build- Test Coverage: Maintain 80%+ overall coverage (90%+ for core logic)
- TypeScript: Use strict mode, avoid
anytypes - Linting: Pass ESLint checks (
npm run lint) - Formatting: Use Prettier (
npm run format) - Tests: Add tests for new features
- Ensure all tests pass:
npm test - Ensure code is formatted:
npm run format - Ensure no lint errors:
npm run lint - Commit with clear message:
git commit -m "feat: add new feature" - Push to your fork:
git push origin feature/your-feature - Open a Pull Request with description of changes
Follow conventional commits:
feat:- New featurefix:- Bug fixdocs:- Documentation changestest:- Test changesrefactor:- Code refactoringchore:- Build/tooling changes
- Chrome Extension Documentation
- Manifest V3 Migration Guide
- Vite Documentation
- TypeScript Documentation
MIT Β© extn
- π Report a bug
- π‘ Request a feature
- π Read the docs