久々に Chrome拡張機能 を作ろうとして、 Background Scripts (または Event Scripts) のデバッグのために console.log の出力を確認したくなったので、その方法をメモ。
方法
Chrome拡張機能 の設定を開きます。もちろんデベロッパーモードはオンにしている状態で。
![「バックグラウンドページ」を開く](https://labor.ewigleere.net/wp-content/uploads/2022/01/chrome-extension-background-script-debug-consolelog-20220102_1.jpg)
その状態で、自作して読み込ませている Chrome拡張機能 のカードから「ビューを検証」の横の「バックグラウンドページ」を開きます。
![バックグラウンドページ用の Console](https://labor.ewigleere.net/wp-content/uploads/2022/01/chrome-extension-background-script-debug-consolelog-20220102_2.jpg)
すると、通常の Cosnole のようなダイアログが開きます。 Background Scripts (または Event Scripts) に記述された console.log
の内容はここに出力されるので確認できます。
普段あまりやらないと忘れますね……。