Can’t import Swivel script into Service Worker JS file
Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'https://localhost:44386/node_modules/node_modules/swivel/worker' failed to load. at https://localhost:44386/service-worker.js:2:1
The file is in my project’s file explorer:
My service worker code is trying to import the script with the following code:
importScripts('node_modules/node_modules/swivel/worker'); var swivel = createChannel();
Basically, I’m trying to import this "swivel" package and use it in my service-worker.js file.
I need to be able to import this script. But, I can’t seem to be able to do that.
Pretty annoying if you ask me!
Could someone please shed some light on this for me? I really appreciate it.
Source: JavaSript – Stack OverflowNovember 27, 2021