A command line tool to help build, run, and test web extensions
Switch branches/tags
Clone or download
Failed to load latest commit information.
.githooks/commit-msg test: Changed changelog linting to check the pull request title (#704) Dec 28, 2016
artifacts chore: add validation for config option values of incorrect types (#842) Aug 14, 2017
bin feat: You can now use web-ext programatically, e.g. `webExt.cmd.run()` ( Aug 4, 2017
src fix: Permit single-line JSON comments (#1361) Aug 29, 2018
tasks fix: upgrade eslint to version 4.10.0 and fix new linting errors (#1128) Dec 13, 2017
tests fix: Permit single-line JSON comments (#1361) Aug 29, 2018
.ackrc chore: add some defaults for ack Jun 12, 2017
.babelrc refactor: use async/await syntax (#411) Sep 15, 2016
.conventional-changelog-lintrc chore: make changelog linting more sane (#559) Oct 6, 2016
.editorconfig fix: Fixed bugs in `build` and `run` where I/O streams weren't closed… Jan 18, 2017
.eslintrc fix: upgrade eslint to version 4.10.0 and fix new linting errors (#1128) Dec 13, 2017
.flowconfig Test: add more flow types (#424) Aug 12, 2016
.gitignore chore: Ignore package-lock.json Jan 9, 2018
.npmignore fix: Fixed `Cannot find module '../dist/web-ext'` after installation Jul 11, 2016
.npmrc Add save-prefix setting via .npmrc Mar 2, 2016
.nsprc chore: Ignore Hawk security advisory because we don't use Hawk (#1258) Feb 16, 2018
.travis.yml chore: Replaced npm token in the travis config file (#1345) Jul 16, 2018
CODE_OF_CONDUCT.md chore: web-ext is governed by Mozilla's code of conduct (#645) Nov 23, 2016
Gruntfile.js fix: update addons-linter to version 0.26.1 and fix linting and funct… Sep 29, 2017
ISSUE_TEMPLATE.md chore: use real comments in the github issue template (#949) May 18, 2017
LICENSE chore: Adds git pre-push hook that validates commit message formatting ( Oct 3, 2016
README.md docs: Fix getValidatedManifest() example (#1219) Jan 19, 2018
appveyor.yml fix(test): Fixed remaining issues to run unit tests successfully on n… May 2, 2018
package.json chore: bump package version for release 2.9.1 Aug 30, 2018
webpack.config.js chore: upgrade to webpack 2 (#945) May 11, 2017



This is a command line tool to help build, run, and test WebExtensions.

Build Status Coverage Status Dependency Status devDependency Status

Ultimately, it aims to support browser extensions in a standard, portable, cross-platform way. Initially, it will provide a streamlined experience for developing Firefox Extensions.


Here are the commands you can run. Click on each one for detailed documentation or use --help on the command line, such as web-ext build --help.

  • run
    • Run the extension
  • lint
    • Validate the extension source
  • sign
    • Sign the extension so it can be installed in Firefox
  • build
    • Create an extension package from source
  • docs
    • Open the web-ext documentation in a browser

Installation from npm

First, make sure you are running the current LTS (long term support) version of NodeJS.

Global command

You can install this command onto your machine globally with:

npm install --global web-ext

For your project

Alternatively, you can install this command as one of the devDependencies of your project. This method can help you control the version of web-ext as used by your team.

npm install --save-dev web-ext

Next you can use the web-ext command in your project as an npm script. Here is an example where the --source-dir argument specifies where to find the source code for your extension.


"scripts": {
  "start:firefox": "web-ext run --source-dir ./extension-dist/",

You can always pass in additional commands to your npm scripts using the -- suffix. For example, the previous script could specify the Firefox version on the command line with this:

npm run start:firefox -- --firefox=nightly

Installation from source

You'll need:

  • Node.js, 6.0.0 or higher
  • npm, 3.0.0 or higher is recommended

Optionally, you may like:

  • nvm, which helps manage node versions

If you had already installed web-ext from npm, you may need to uninstall it first:

npm uninstall --global web-ext

Change into the source and install all dependencies:

git clone https://github.com/mozilla/web-ext.git
cd web-ext
npm install

Build the command:

npm run build

Link it to your node installation:

npm link

You can now run it from any directory:

web-ext --help

To get updates, just pull changes and rebuild the executable. You don't need to relink it.

cd /path/to/web-ext
git pull
npm run build

Using web-ext in NodeJS code

Aside from using web-ext on the command line, you may wish to execute web-ext in NodeJS code. There is limited support for this. Here are some examples.

You are able to execute command functions without any argument validation. If you want to execute web-ext run you would do so like this:

// const webExt = require('web-ext').default;
// or...
import webExt from 'web-ext';

  // These are command options derived from their CLI conterpart.
  // In this example, --source-dir is specified as sourceDir.
  firefox: '/path/to/Firefox-executable',
  sourceDir: '/path/to/your/extension/source/',
}, {
  // These are non CLI related options for each function.
  // You need to specify this one so that your NodeJS application
  // can continue running after web-ext is finished.
  shouldExitProgram: false,
  .then((extensionRunner) => {
    // The command has finished. Each command resolves its
    // promise with a different value.
    // You can do a few things like:
    // extensionRunner.reloadAllExtensions();
    // extensionRunner.exit();

If you would like to control logging, you can access the logger object. Here is an example of turning on verbose logging:

webExt.cmd.run({sourceDir: './src'}, {shouldExitProgram: false});

You can also disable the use of standard input:

webExt.cmd.run({noInput: true}, {shouldExitProgram: false});

web-ext is designed for WebExtensions but you can try disabling manifest validation to work with legacy extensions. This is not officially supported.

  {sourceDir: './src'},
    getValidatedManifest: () => ({
      name: 'some-fake-name',
      version: '1.0.0',
    shouldExitProgram: false,

Should I Use It?

Yes! The web-ext tool enables you to build and ship extensions for Firefox. This platform stabilized in Firefox 48 which was released in April of 2016.

Get Involved

Hi! This tool is under active development. To get involved you can watch the repo, file issues, create pull requests, or ask a question on dev-addons. Read the contributing section for how to develop new features.

Some Questions and Answers

Why do we need a command line tool?

This is a great question and one that we will ask ourselves for each new web-ext feature. Most WebExtension functionality is baked into the browsers themselves but a complimentary command line tool will still be helpful. Here is a partial list of examples:

  • File watching.
    • When you edit a file, you may need to trigger certain commands (tests, installation, etc).
  • Integrating with services.
    • Mozilla offers some useful services such as linting and signing extensions.

Why not patch jpm for WebExtensions support?

First, note that jpm is still actively maintained by Mozilla right now. We decided not to patch jpm for WebExtensions support (See jpm issue 445, discussion).

Mozilla built cfx then deprecated it for jpm and now we're proposing a new tool. I know this is frustrating for developers, but WebExtensions mark a major turning point. It would be an arduous task to wedge its feature set and simplified development process into jpm.

Pros of creating a new tool:

  • By creating a new tool that focuses on the [emerging] WebExtensions standard, we have a better chance of interoperating with other platforms, such as Google Chrome or Opera. It would be hard to do that while preserving compatibility in jpm.
  • Creating SDK-based add-ons was overly complicated. With WebExtensions you no longer need to convert your source into legacy artifacts and you won't need boostrapping scripts.
  • There are superior features in Firefox now for developing extensions such as loading from source code instead of a packaged XPI. It will be easier to reimagine a new tool around these work flows rather than adjust jpm's existing work flows.
  • jpm's functional tests are slow, brittle and hard to run. There are flaky time-outs and we've run out of low hanging fruit fixes at this point.
  • Most of jpm's code was not designed to be unit testable which makes it hard to maintain and refactor.
  • jpm's code was written in ES5 which is cumbersome after coming from the ES6 Firefox code base or from most other languages with modern conveniences (Python, Ruby, etc).
  • Some core functionality of jpm can be extracted and re-used in the new tool.

Cons of creating a new tool:

  • Firefox extension developers will have to interrupt and re-arrange their work flows.
  • Developers of existing add-ons will need to port to WebExtensions sooner rather than later.
  • The web-ext tool will require some ramp-up time for scaffolding.
  • The community of jpm contributors will need to shift focus to web-ext.