Chrome Extension boilerplate for manifest v3.
![]()
Uses Parcel Web Extension Config and release-it for GitHub releases.
- After project initialization change
namefield in thepackage.jsonfile. This field will be used as name for.zipwith release. Not thenamefield from themanifest.json. - Version number for release is used as per
package.json.Manifest.jsonwill be updated during release with the same value. So no need to update version insidemanifes.jsonmanually if you will usereleasescript. - there is configured Dependabot version updates.
If you do not want to have PRs with your dependencies version updates, remove
.github/dependabot.ymlfile.
- Check if your Node.js version is >= 16.
- Run
npm installto install the dependencies. - Run
npm start - Load your extension on Chrome following:
- Access
chrome://extensions/ - Check
Developer mode - Click on
Load unpacked extension - Select the
distfolder.
- Access
- Stop development script (if it is running)
- Remove installed dev. extension at
chrome://extensions/ - Run
npm run build - Load your extension on Chrome following:
- Access
chrome://extensions/ - Check
Developer mode - Click on
Load unpacked extension - Select the
distfolder
- Access
Also, zip file with production extension's code will be created in releases folder.
This code is ready for uploading to Chrome Web Store.
Template uses release-it for release on GitHub.
- Generate
personal access tokenin GitHub. Go to Github->Settings->DeveloperSettings->PersonalAccessTokens. Onlyreposcope is required. - Rename already existing
.env.examplefile to.envand put generatedpersonal access tokenthere. It will look like:GITHUB_TOKEN="your generated token" - Run
npm run release. Under the hood it will runnpm run buildsteps, make version bump (in bothpackage.jsonandmanifest.json), commit, push and make GitHub release with generatedzipfile attached.
If you need to have some page which is not listed in manifest.json, you may add it as additional entry point.
Something like that:
"start": "parcel watch src/manifest.json src/panel/panel.html --host localhost",
"build": "parcel build src/manifest.json src/panel/panel.html --no-cache"In that case panel folder will be created in dist
and you may reference it from your code like panel/panel.html.