[Vuejs]-The script has an unsupported MIME type ('text/html') for firebase messaging service integration in vue js

0๐Ÿ‘

@Onyoursix, Try to place firebase-messaging-sw.js into the public folder like {project_root}\public\firebase-messaging-sw.js and try with the below code and remove everything relevant to firebase push notifications code

importScripts('https://www.gstatic.com/firebasejs/3.9.0/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/3.9.0/firebase-messaging.js');

var config = {
    apiKey: "{YOUR_APIKEY}",
    authDomain: "{YOUR_AUTH_DOMAIN}",
    databaseURL: "{YOUR_DATABASE_UR}",
    projectId: "{YOUR_PROJECT_ID}",
    storageBucket: "{YOUR_STORAGE_BUCKET}",
    messagingSenderId: "{YOUR_MESSAGING_SENDER_ID}",
    appId: "{YOUR_APP_ID}"
      }
firebase.initializeApp(config)
const messaging = firebase.messaging();

Leave a comment