Using Extensions

Using extensions is fairly straightforward. Let’s learn how!

Importing an extension

In order to use an extension, just import it from or another remote Collection:

bit import bit.extensions/commands/pack --extension


Imported extensions are stored in .bit/components/extensions directory.

Configuration and options

Extensions’ configuration and options are part of the bit config.

"extensions": {
        "ext-docs-parser": {
            "rawConfig": {},
            "options": {
                "core": true


System-wide options that are relevant for every Bit extension.

  • core - Determines whether the extension is a core extension (bool).
  • disabled - When true, Bit won’t load the extension (bool).
  • file - A path to the extension’s main file. The file path is relative to the working directory’s location, or an absolute path. When provided, Bit will load the extension from this path, and not from the usual location.


Contains all the configuration the extension needs. Unlike the system options, the configuration is used for the usage of the specific extension.

Load an extension programmatically

You can also load an extension programmatically:

loadExtension: async (
   extensionName: string,
   extensionFilePath: string,
   extensionConfig: Object,
   extensionOptions: Object
 ): Extension

loadExtension returns an instance of Extension:

    name: string,
    loaded: boolean,
    disabled: boolean,
    filePath: string,
    registeredHooksActions: RegisteredHooksActions,
    newHooks: string[],
    commands: Commands,
    rawConfig: Object,
    options: Object,
    dynamicConfig: Object,
    script: Function, // Store the required plugin

Here’s an example:

const bit = require('bit-bin');

const extensionName = 'bit-npm-pack';
const extensionFilePath = '/Users/giladshoham/dev/temp/pluginTest/dist/bit-pack';
const extensionConfig = {
  "rawConfigKey": "rawConfigVal",

bit.loadExtension(extensionName, extensionFilePath, extensionConfig)
  .then((extension) => {
    const packCommand = extension.commands.find(cmd => {
      return'plugin-pack') > -1;
    packCommand.action(["scoop/plugin-test/component", "/Users/giladshoham/dev/temp/pluginTest/scoop"], 
                        {outDir: "/Users/giladshoham/dev/temp/pluginTest"})
  }).catch(err => {