vuejs-templates / pwa

PWA template for vue-cli based on the webpack template
MIT License
3.04k stars 506 forks source link

Problem when importing firebase-messaging-sw to SW service worker. #193

Open eeerrrttty opened 6 years ago

eeerrrttty commented 6 years ago

It's returning to me the following error in console:

Here is my configuration:

        new SWPrecacheWebpackPlugin({
            cacheId: 'teste',
            filename: 'service-worker.js',
            importScripts: ['./firebase-messaging-sw.js'],
            staticFileGlobs: ['dist/**/*.*'],
            minify: true,
            stripPrefix: 'dist/'
        })

Here is my firebase-messaging-sw.js:

import * as firebase from 'firebase'
require('firebase/firestore')

firebase.initializeApp({config})

const messaging = firebase.messaging()

Error during service worker registration:

TypeError: Failed to register a ServiceWorker: ServiceWorker script evaluation failed

donaldboulton commented 6 years ago

Me to, how to add?

m16u31D commented 5 years ago

same problem, any solution?