shadowwalker / next-pwa

Zero config PWA plugin for Next.js, with workbox 🧰
MIT License
3.71k stars 312 forks source link

Nextjs v13: How to bundle an external library to use it in a service worker? #454

Open ninsky opened 1 year ago

ninsky commented 1 year ago

Hi

I'm using next-pwa to create a progressive web app. Till today I didn't find out how to bundle an external library (https://github.com/jakearchibald/idb) to use the library in a service worker. Instead I had to duplicate my code from the /src to the scope of the service worker which is the /public folder in my case.

Now with Nextjs13 there seems to be an easier way to bundle external packages. Does anyone have an example how to bundle an external library like "idb" and import it in a service worker and in the "/src" folder?

Thanks in advance Nino

marharyta commented 7 months ago

@ninsky did you ever find the solution? Facing the same problem now!