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 preview
command allows you to run your extension in a production-like environment without making a final build. It simulates how the extension will behave in a production browser environment. This is helpful for testing before officially deploying or building the extension.
The build
command compiles your extension and creates a production-ready package that the preview
command can run. The preview
command runs the production-ready package in a browser environment, allowing you to test the extension's functionality.
The preview
command can also accept a specific directory where you want to preview the extension.
If no path is provided, it defaults to the current working directory.
In this example, the extension is created in the path/to/my-extension
directory.
Flag | Argument | What it does | Defaults to |
---|---|---|---|
[path or url] | The extension path or the remote extension URL | If a path is defined, previews the local extension. If a URL is provided, pulls the extension from remote source and previews it as a local extension | process.cwd() |
--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 |
preview
to test how your extension will behave in production before using the build
command for the final package.--browser
flag to test your extension in different browsers.extension.config.js
file to configure your extension.