dev.cliShortcuts

  • Type:
type CliShortcuts =
  | boolean
  | {
      help?: boolean;
      custom?: (shortcuts?: CliShortcut[]) => CliShortcut[];
    };
  • Default: true when using Rsbuild CLI, false otherwise.
  • Version: >= 1.0.11

Whether to enable CLI shortcuts.

All Shortcuts

Press h + Enter to show all shortcuts:

Shortcuts: c + enter clear console o + enter open in browser q + enter quit process r + enter restart server u + enter show urls

Example

  • Enable:
export default {
  dev: {
    cliShortcuts: true,
  },
};
  • Disable:
export default {
  dev: {
    cliShortcuts: false,
  },
};

Custom Shortcuts

custom option can be used to custom shortcuts, the value is a function that receives the default shortcuts array and returns a new shortcuts array.

  • Add custom shortcuts:
export default {
  dev: {
    cliShortcuts: {
      custom: (shortcuts) => {
        return [
          ...shortcuts,
          {
            key: 's',
            description: 'say hello',
            action: () => {
              console.log('hello world!');
            },
          },
        ];
      },
    },
  },
};
  • Disable some shortcuts:
export default {
  dev: {
    cliShortcuts: {
      custom: (shortcuts) => {
        return shortcuts.filter((shortcut) => shortcut.key !== 'o');
      },
    },
  },
};

help option can be used to control whether to print the help hint when the server is started:

➜ press h + enter to show shortcuts
  • Disable:
export default {
  dev: {
    cliShortcuts: {
      help: false,
    },
  },
};