Recibí este error en Angular cuando intento conectar la configuración de notificación push de firebase.
import { initializeApp } from 'https://www.gstatic.com/firebasejs/9.1.0/firebase-app.js'; import { getMessaging, isSupported, onBackgroundMessage } from 'https://www.gstatic.com/firebasejs/9.1.0/firebase-messaging-sw.js'; // Initialize the Firebase app in the service worker by passing in the // messagingSenderId. const firebaseApp = initializeApp({ apiKey: "", authDomain: "", projectId: "", storageBucket: "", messagingSenderId: "", appId: "", measurementId: "" }); // Retrieve an instance of Firebase Messaging so that it can handle background // messages. isSupported().then(isSupported => { if (isSupported) { const messaging = getMessaging(app); onBackgroundMessage(messaging, ({ notification: { title, body, image } }) => { self.registration.showNotification(title, { body, icon: image || '/assets/icons/icon-72x72.png' }); }); } });
Debe decirle que es un módulo cuando registra un trabajador de servicio
Vea este problema resuelto en GitHub: https://github.com/angular/angularfire/issues/3049#issuecomment-963388580