进度插件

此插件可用于配置进度条。

Rspack 使用 indicatif::ProgressBar 来绘制进度条。

new rspack.ProgressPlugin(options);

选项

函数

提供一个处理程序函数,当钩子报告进度时将调用此函数。handler 函数参数

  • percentage: 一个介于 0 和 1 之间的数字,表示编译完成的百分比
  • message: 当前执行的钩子的简短描述
  • ...args: 零个或多个描述当前进度的附加字符串
const handler = (percentage, message, ...args) => {
  // e.g. Output each progress message directly to the console:
  console.info(percentage, message, ...args);
};

new rspack.ProgressPlugin(handler);

对象

前缀

  • 类型: string
  • 默认值: 'Rspack'

此文本将显示在进度条之前。

概要文件

  • 类型: boolean
  • 默认值: false

告诉 ProgressPlugin 收集进度步骤的概要文件数据。

模板

  • 类型: string
  • 默认值: ● {prefix:.bold} {bar:25.green/white.dim} ({percent}%) {wide_msg:.dim}

进度条的模板。

另请参阅 indicatif::ProgressBar::with_template

滴答

  • 类型: string | string[] | undefined
  • 默认值: undefined

用于微调器的滴答字符串序列,如果它是字符串,它将被拆分为字符。

另请参阅 indicatif::ProgressBar::tick_strings

进度字符

  • 类型: string
  • 默认值: ━━

进度字符 (已填充、当前、待办)

另请参阅 indicatif::ProgressBar::progress_chars