Create web extensions with no build configuration. Inspired by create-react-app.
npx webextension-create
cd my-webextension
npm start
Then open your browser and load the unpacked folder. Any changes you make will automatically reload your extension.
When you are ready to publish your extension run npm run build
to create all of the folders you'll need to upload.
You don't need to install or configure tools like Webpack or Babel. Everything is preconfigured and hidden so you can focus on the code.
To create a new web extension you can use:
npx webextension-create
This will initiate the CLI asking for a project name and choice of template that will generate one of the following project structures:
my-webextension
├── node_modules
├── src
│ ├── background.js
│ ├── content_script.js
│ ├── icon.png
│ ├── manifest.json
│ ├── popup.html
│ └── popup.js
├── .gitignore
├── package.json
└── README.md
my-webextension
├── node_modules
├── src
│ ├── App.jsx
│ ├── background.js
│ ├── content_script.js
│ ├── icon.png
│ ├── manifest.json
│ ├── popup.html
│ └── popup.jsx
├── .gitignore
├── package.json
└── README.md
my-webextension
├── node_modules
├── src
│ ├── App.tsx
│ ├── background.ts
│ ├── content_script.ts
│ ├── icon.png
│ ├── manifest.json
│ ├── popup.html
│ ├── popup.tsx
│ └── webextension-env.d.ts
├── .gitignore
├── package.json
├── README.md
└── tsconfig.json
my-webextension
├── node_modules
├── src
│ ├── background.ts
│ ├── content_script.ts
│ ├── icon.png
│ ├── manifest.json
│ ├── popup.html
│ ├── popup.ts
│ └── webextension-env.d.ts
├── .gitignore
├── package.json
├── README.md
└── tsconfig.json
Once the setup if finished you can run
cd my-webextension
Now that you are inside the newly created project you can run some built in commands:
Compiles the extension into ./build/unpacked
to be that can be loaded into Chrome or Firefox for development.
The extension will automatically reload when you save changes.
- Open Chrome
- Go to
chrome://extensions
- Turn on
Developer mode
- Click
Load unpacked
- Select folder
./build/unpacked
- Open Firefox
- Go to
about:debugging
- Click
Load Temporary Add-on...
- Open
./build/unpacked/manifest.json
Compiles the extension into ./build/unpacked
and then packages that into production ready zips at ./build/{target}-{version}.zip
.