📦

Production-Ready Builds

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.

Building a production-ready extension with Extension.js is straightforward, allowing you to bundle your code, optimize assets, and generate ready-to-deploy zip files for all supported browsers. This guide covers the key features and capabilities that help you create optimized builds that are ready for the Chrome, Edge, and Firefox stores.

How Does It Work?

Each browser has its own set of requirements and configurations for extensions. To create a production-ready build of your extension, run the following command:

npm
pnpm
yarn
npx extension build

This will create a production build in the dist/ folder for the default browser (Chrome). The output includes optimized JavaScript, CSS, and other assets.

Building for Specific Browsers

You can also target specific browsers using the --browser flag:

npm
pnpm
yarn
npx extension build --browser=firefox

The resulting build will be placed in dist/firefox, including any necessary browser-specific configurations.

Generating a Zip File

To automatically generate a zip file for distribution, use the --zip flag. The zip file will include all necessary assets and manifest files for the specified browser:

npm
pnpm
yarn
npx extension build --zip

The zip file will be named according to the extension's name and version in manifest.json (e.g., my-extension-1.0.0.zip for Chrome).

Polyfill Support

Ensure compatibility with older browsers by adding the --polyfill flag. This includes necessary polyfills during the build process to ensure your extension runs on older versions of the browser:

npm
pnpm
yarn
npx extension build --polyfill

Best Practices

  • Test Builds: Test your extension in different browsers to ensure compatibility.

Next Steps