以下のスクリプトでは、私のレポにコミットしたくないfirebase変数をハードコーディングしています。私のfirebaseの値はすべて1つのファイルに収められていて、残りの部分はES6モジュール(およびwebpack)を使用しているものをインポートします。しかし、私は、このサービスのワーカーファイルグローバル変数がgitでコミットされていないサービスワーカー
importScripts('https://www.gstatic.com/firebasejs/3.9.0/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/3.9.0/firebase-messaging.js');
// Initialize the Firebase app in the service worker by passing in the config.messagingSenderId.
firebase.initializeApp({
'messagingSenderId': "8033333334"
});
// firebase.initializeApp({
// 'messagingSenderId': config.messagingSenderId
// });
ありがとう、私の既存の設定ファイルの 'export'行はプロblemので、私はswで必要なデータを別のファイルに分けました。少量の複製ではありますが、確実に良い方法です –