Failed To Register A Serviceworker: The Script Has An Unsupported Mime Type ('text/html') Vue Js?
I want to include service worker in my vue js project and i did this before with my simple HTML projects in which it works really great but when i include the same file to my vue j
Solution 1:
I am not sure, but can you try to register the worker like this, so we can have additional information about the progress and set the path correctly:
...
navigator.serviceWorker
.register("service-worker.js", {
scope: './' }).then(function (registration) {
var serviceWorker;
if (registration.installing) {
serviceWorker = registration.installing;
console.log('installing');
} elseif (registration.waiting) {
serviceWorker = registration.waiting;
console.log('waiting');
} elseif (registration.active) {
serviceWorker = registration.active;
console.log('active');
}
if (serviceWorker) {
// logState(serviceWorker.state);
serviceWorker.addEventListener('statechange', function (e) {
// logState(e.target.state);
});
}
}).catch({…})
Can you as well show the
service-worker.js
file?
Post a Comment for "Failed To Register A Serviceworker: The Script Has An Unsupported Mime Type ('text/html') Vue Js?"