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 build
command in Extension.js is responsible for compiling your extension for production.
This command creates optimized builds for different browsers, ensuring compatibility and performance.
The build/
folder will contain subfolders for each targeted browser, each with the necessary code transforms and optimizations.
To use the build
command, run:
After running the build
command, Extension.js generates optimized files for the specified browser.
You will find the output inside the build/
folder, with separate subfolders for each browser (Chrome, Edge, etc.).
These folders contain the bundled JavaScript, CSS, HTML, and other necessary assets for the extension to work in the targeted environment.
Example Output Structure:
Flag | Argument | What it does | Defaults to |
---|---|---|---|
[path or url] | The extension path or the remote extension URL | If a path is defined, builds the local extension. If a URL is provided, pulls the extension from remote source and builds it as a local extension | process.cwd() |
-b, --browser | The browser that will run the extension | Specifies the browser to build for (chrome , edge , all ) |
"chrome" |
--browser
flag.
If you set the flag to "all"
, Extension.js will generate builds for all supported browsers.build
command optimizes the extension for production by applying minification and other performance improvements.--zipFilename
option.To build for Chrome and generate a zip file, run the following:
During the build process, the following steps take place:
--zip
flag is passed, the build output will be packaged into a zip file for easy distribution to the browserβs extension store.--browser=all
option.manifest.json
is optimized and fully compatible with all targeted browsers to avoid build issues.--zipFilename
option, which is useful for organizing builds.