Warning: This feature is a work in progress and may be incomplete or subject to change. If you see an error or something that could be improved, please make a pull-request. The link that documents this feature can be found at the bottom of the page.
The dev
command watches for changes in your extension's files, recompiles them, and reloads the extension in real-time. If you provide a URL, Extension.js will download and run the extension as if it were local.
For development frameworks, it's an industry-standard practice to have a development server that watches for changes in your files and recompiles them in real time. Given the complex nature of browser extensions, the dev
command in Extension.js handles the watch and recompile process for all the different contexts (HTML or not) of your extension.
The dev
command also provides a way to run remote extensions by providing a URL. This is useful when you want to test an extension from source without having to clone the repository.
You can run the dev
command with the following syntax:
The dev
command can also accept a specific directory where you want to dev the extension.
If no path is provided, it defaults to the current working directory.
In this example, the extension is developed in the path/to/my-extension
directory.
Below is a breakdown of the available flags for the dev
command:
Flag | Argument | What it does | Defaults to |
---|---|---|---|
[path or url] |
Extension path or remote URL | If a path is defined, it loads the local extension. If a URL is provided, it pulls the extension from a remote source and loads it as a local extension | process.cwd() |
--polyfill |
Boolean | Enables compatibility for the browser.* API in Chromium-based browsers |
false |
--profile |
Profile path | Specifies a path to a browser profile for testing | default |
-b, --browser |
Browser to run the extension | Specifies the browser to run (chrome , edge , firefox , all ) |
"chrome" |
--chromium-binary |
Path to the Chromium binary | Provides the path to a custom Chromium-based browser binary Read more | undefined |
--gecko-binary |
Path to the Gecko binary | Provides the path to a custom Gecko-based browser binary Read more | undefined |
--starting-url |
URL | Starting URL for testing with the extension | chrome://newtab |
--open |
Boolean | Whether or not to automatically open the browser upon starting dev | true |
--polyfill
flag to enable compatibility for the browser.*
API in Chromium-based browsers.extension.config.js
file to configure your extension.