workbox is not defined inside importScripts js
Library Affected: workbox-webpack-plugin
Browser & Platform: all browsers
Issue or Feature Request Description: I am using workbox-webpack-plugin to setup my service worker. I added the GenerateSW in my webpack config that also has an importScripts as follows:
importScripts: ["./test/new.js"],
however, when I load the webpage I get an error saying "workbox is not defined".
Uncaught (in promise) ReferenceError: workbox is not defined
at new.js:1:790
This is because the new.js file has no reference to the workbox object. My service worker js gets loaded first and it then initiates request for workbox.js.
The docs claim that the workbox object will get auto injected during build, but this does not seem like the case (or am I totally wrong?); Is the new.js running before the workbox.js could be downloaded? Could someone please point me what I am doing wrong here?
I'm having the same issue. (This was code that was working before)
Uncaught (in promise) ReferenceError: workbox is not defined at IndexedDB-Redirect.js:127:47
Hi there,
Workbox is moving to a new engineering team within Google. As part of this move, we're declaring a partial bug bankruptcy to allow the new team to start fresh. We realize this isn't optimal, but realistically, this is the only way we see it working. For transparency, here're the criteria we applied:
- For PRs, we closed everything that doesn't target the current
v7branch. - For Issues, we closed everything that was created before 2024.
Thanks, and we hope for your understanding! The Workbox team