Chrome Extension starter using Nx workspace and Angular.
✅ Nx Workspace
✅ Angular
✅ Typescript
✅ Chrome Types
✅ Live Reload
✅ Very Fast Build
✅ All In One Command
✅ Support Manifest V3
✅ Popup Page
✅ Options Page
✅ Devtools Panel
✅ Background Script
✅ Content Script
- Install dependencies
npm i
- Run development live reload
npm run start:dev
- Open Chrome browser
- Go to this url:
chrome://extensions
- Click on
"Developer mode"
- Click on
"Load unpacked"
- Choose the
extension
directory from this root directory - Yay, you did it! 😏
- Now update the code as you want! 😛
ℹ️ More info about developing Chrome extension can be found here
So the purpose is to take the advantage of the type system of TypeScript and to use the power of Nx workspace to create multiple applications with the powerful framework Angular!
So we have 3 applications:
- Popup (
apps/popup
) - used for the upper popup - Options (
apps/options
) - used for the options page - DevTools Panel (
apps/devtools-panel
) - used for the devtools panel
In every Chrome extension we have background script that communicate with the content scripts, which can be found in apps/scripts/background/src/main.ts
.
We are also can inject content script which can be found in apps/scripts/content/src/main.ts
.
All the applications have already the Chrome types so can just use chrome
and the editor will recognize it.
Start with development configuration
npm run start:dev
Start with production configuration.
npm run start:prod
Build with development configuration.
npm run build:dev
Build with production configuration.
npm run build:prod
I recommend making the release automatic with GitHub actions or other ci service.
- Bump the version number in
manifest.json
- Create a git tag containing the version you are releasing using
git tag -a <version>
- Run
npm run build:prod
- Create zip file from the extension directory
- Upload the zip to the Chrome developer dashboard