next-pwa icon indicating copy to clipboard operation
next-pwa copied to clipboard

Uncaught ReferenceError: regeneratorRuntime is not defined

Open mycolaos opened this issue 3 years ago • 3 comments

Summary

This is the issue https://github.com/GoogleChrome/workbox/issues/2493

How To Reproduce

  1. Copy the examples/offline-fallback/service-worker.js file into the examples/custom-worker/worker folder.
  2. Require the copied file in the examples/custom-worker/worker/index.jsrequire("./custom-worker");.
  3. Run the custom-worker example, the error should appear in the service worker console.

P.S.: The offline-fallback examples works, but it uses swSrc to add the worker.

The reason of the bug is probably the ./worker/index.js transpilation in the next-pwa/index.js which doesn't handle the regeneratorRuntime issue.

Expected Behaviors

Preferably the bug should be handled, but in any case I would expect that the transpilation of the ./worker/index.js and the swSrc worker is the same.

Additional Context

It was really hard to find the reason of the bug's origin, why it happens in next-pwa, or is it next-pwa problem or next.js problem, try the different examples, try different setups with my own code, etc. You got the idea. That's why I think the way to go is to make sure the transpilation is the same for all the cases (swSrc and worker and even the default service worker creation), so the surface for bugs breeding is smaller. 🐛 🐛 🐛

mycolaos avatar Jan 27 '21 11:01 mycolaos

Could someone help with a minimal error reproduce repository?

shadowwalker avatar Feb 05 '21 04:02 shadowwalker

The described steps do not reproduce the error anymore?

mycolaos avatar Feb 05 '21 20:02 mycolaos

@mycolaos I still couldn't reproduce the error, it would be nice if I could have a setup repository to trouble shoot this issue.

shadowwalker avatar Apr 18 '21 16:04 shadowwalker