This is a simple starter template for building Chrome Extensions using Manifest V3, TypeScript, and Webpack.
- Uses Manifest V3 (latest Chrome extension format)
- Background script as service worker
- Content script injection
- Popup and Options pages with HTML, CSS, and TypeScript
- Webpack build system with TypeScript support
- Clean folder structure for easy development
src/— Your TypeScript source files (background.ts, content.ts, popup.ts, options.ts)html/— HTML files for popup and options pagespublic/— Static assets like icons and imagesdist/— Compiled output files (generated by Webpack)manifest.json— Chrome extension manifest file
- Node.js and npm installed on your machine
- Basic knowledge of Chrome extensions and TypeScript
Run this command to install all needed packages:
npm installTo build the extension files (compile TypeScript and bundle with Webpack), run:
npm run buildThis creates the dist/ folder with all JavaScript files and copies necessary assets.
To automatically rebuild when you change source files, run:
npm run watchor
npm run wc(The wc command cleans the dist/ folder and starts watch mode.)
- Open Chrome and go to
chrome://extensions - Enable "Developer mode" (top right)
- Click "Load unpacked"
- Select the root folder of this project (make sure
manifest.jsonis there) - The extension will load, and you can test it in the browser
manifest.jsontells Chrome how your extension works- Background script runs as a service worker (in
dist/background.js) - Content scripts run on all pages and can inject CSS or JS (
dist/content.js) - Popup page shows UI when you click the extension icon (
html/popup.htmlanddist/popup.js) - Options page allows user settings (
html/options.htmlanddist/options.js) - Webpack bundles and compiles your TypeScript code into JavaScript
- Edit the TypeScript files in
src/ - Edit the HTML files in
html/ - Edit styles in
html/css/style.css - Run
npm run buildornpm run watchto compile changes
To remove the dist/ folder, run:
npm run cleanor
npm run cFeel free to fork and modify this template for your own Chrome extension projects!