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:

enter image description here

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 Overflow

November 27, 2021
Category : News
Tags: importerror | javascript | service-worker

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.