In my service worker file, I am using this code:
importScripts("https://storage.googleapis.com/workbox-cdn/releases/3.0.0-beta.2/workbox-sw.js");
const workbox = new WorkboxSW();
But I am getting error Uncaught ReferenceError: WorkboxSW is not defined hence my service worker is not registering.
In Workbox v3, you won't normally explicitly construct a
WorkboxSWinstance. Instead, there's aworkboxvariable exposed in the global scope that provides the interface to the library.Here's an example, excepted from the migration guide: