I got this error in Angular when try to connect firebase push notification setting.

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' });
});
}
});
You need to tell it it's a module when you register a service worker
See this resolved issue on GitHub: https://github.com/angular/angularfire/issues/3049#issuecomment-963388580