This is a chrome extension starter based on Next.js. The extension manifest version is set as v3.
Code Directory | Generated File |
---|---|
app/(pages)/options |
options.html |
app/(pages)/popup |
popup.html |
app/scripts/content |
content-script.js |
app/scripts/inject |
inject-script.js |
- Install dependencies
npm install
- Build extension
npm run build:extension
- Generate icon
python3 icon_generator.py nextextension-start.png
You can use bun
alternatively:
- Install dependencies by bun
bun install
- Build extension by bun
bun bun:extension
-
pack:extensionscript
: Generates the actual content-script.js and inject-script.js. -
afterbuild
: Extracts inline scripts from the packaged HTML files and includes them using the src attribute. The reason is Chrome extensions do not support inline scripts. -
zip:extension
: Generates a packaged file for the extension, making it easier for distribution. The zip file can be included in the project release.
-
extension.next.config.js
: Contains the actual Next.js configuration for the extension. The originalnext.config.js
is preserved for debugging HTML styles locally usingnpm run dev
. -
extension.webpack.config.js
: Corresponds to the npm scriptpack:extensionscript
, used for packaging the two script files. You can also add additional scripts as needed.