Build command
Create production extension artifacts for one or more browser targets.
build compiles your extension in production mode and writes output to dist/<browser>.
For monorepo/submodule projects, config-time env resolution (project root first, then workspace-root fallback) is documented in Environment variables.
When to use build
- Preparing extension packages for Chrome Web Store, Edge Add-ons, or Firefox Add-ons.
- Running CI jobs that produce deterministic release artifacts.
- Validating production bundle output and browser-target differences before submission.
Build command capabilities
Usage
Build output
After running build, Extension.js generates optimized files for the selected browser targets. Output is written to dist/ with one subfolder per target. Each folder contains bundled JavaScript, CSS, HTML, and required runtime assets.
Example output structure:
Browser target matrix
Arguments and flags
Shared global options
Also supports global flags.
Zip behavior
Examples
Building with zip output and custom filename
In this example, the build will target Edge and Chrome, with the output zipped and saved as my-extension.zip.
Building with polyfill support
In this example, the build targets Chrome and Firefox and includes polyfill support where relevant.
Building source and artifact zip
Best practices
- Check build logs: Review logs for warnings and missing assets after each build.
- Optimize your manifest: Keep
manifest.jsoncompatible with every target browser. - Name artifacts intentionally: Use
--zip-filenamefor stable CI artifact naming. - Validate target output: Check each
dist/<browser>folder before publishing.
Next steps
- Run existing build output with
preview. - Build and launch in one command with
start. - Configure shared defaults in
extension.config.js. - Review config env loading behavior in Environment variables.
- Review supported targets in browsers available.
