CC 4.0 ライセンス

このセクションの内容は、以下のリンクの内容を基にしており、CC BY 4.0 ライセンスの対象となります。

特に明記されていない限り、以下の内容は、元のコンテンツに基づいた修正と削除の結果であるとみなすことができます。

InfrastructureLogging

インフラストラクチャレベルのロギングのためのオプション。一般的に、コンパイルとは無関係なログに使用されます。

infrastructureLogging.appendOnly

  • 型: boolean

既存の出力を更新する代わりに、出力に行を追加します。ステータスメッセージに役立ちます。このオプションは、カスタムのconsoleが提供されていない場合にのみ使用されます。

rspack.config.js
module.exports = {
  //...
  infrastructureLogging: {
    appendOnly: true,
    level: 'verbose',
  },
  plugins: [
    compiler => {
      const logger = compiler.getInfrastructureLogger('MyPlugin');
      logger.status('first output'); // this line won't be overridden with `appendOnly` enabled
      logger.status('second output');
    },
  ],
};

infrastructureLogging.colors

  • 型: boolean

インフラストラクチャレベルのロギングの色付き出力を有効にします。このオプションは、カスタムのconsoleが提供されていない場合にのみ使用されます。

rspack.config.js
module.exports = {
  //...
  infrastructureLogging: {
    colors: true,
    level: 'verbose',
  },
  plugins: [
    compiler => {
      const logger = compiler.getInfrastructureLogger('MyPlugin');
      logger.log('this output will be colorful');
    },
  ],
};

infrastructureLogging.console

  • 型: Console
  • デフォルト: Console

インフラストラクチャレベルのロギングに使用されるコンソールをカスタマイズします。

rspack.config.js
module.exports = {
  //...
  infrastructureLogging: {
    console: yourCustomConsole(),
  },
};

infrastructureLogging.debug

  • 型: boolean | RegExp | function(name) => boolean | [string, RegExp, function(name) => boolean]
  • デフォルト: 'false'

プラグインやローダーなどの指定されたロガーのデバッグ情報を有効にします。stats.loggingDebug オプションに似ていますが、インフラストラクチャ用です。デフォルトはfalseです。

rspack.config.js
module.exports = {
  //...
  infrastructureLogging: {
    level: 'info',
    debug: ['MyPlugin', /MyPlugin/, name => name.contains('MyPlugin')],
  },
};

infrastructureLogging.level

  • 型: 'none' | 'error' | 'warn' | 'info' | 'log' | 'verbose'
  • デフォルト: 'info'

インフラストラクチャロギングの出力を有効にします。stats.logging オプションに似ていますが、インフラストラクチャ用です。デフォルトは'info'です。

可能な値

  • 'none' - ロギングを無効にする
  • 'error' - エラーのみ
  • 'warn' - エラーと警告のみ
  • 'info' - エラー、警告、情報メッセージ
  • 'log' - エラー、警告、情報メッセージ、ログメッセージ、グループ、クリア。折りたたまれたグループは折りたたまれた状態で表示されます。
  • 'verbose' - デバッグとトレースを除くすべてのログ。折りたたまれたグループは展開された状態で表示されます。
rspack.config.js
module.exports = {
  //...
  infrastructureLogging: {
    level: 'info',
  },
};

infrastructureLogging.stream

  • 型: NodeJS.WritableStream
  • デフォルト: process.stderr

ロギング出力に使用されるストリーム。デフォルトはprocess.stderrです。このオプションは、カスタムのconsoleが提供されていない場合にのみ使用されます。

rspack.config.js
module.exports = {
  //...
  infrastructureLogging: {
    stream: process.stderr,
  },
};